add more detail to logging regarding "More than one row matched" error (#4234)

This commit is contained in:
Ben Parsons 2018-12-04 10:57:39 +00:00 committed by Richard van der Hoff
parent ecc23188f4
commit b5ac0ffa0a
2 changed files with 7 additions and 6 deletions

1
changelog.d/4234.misc Normal file
View File

@ -0,0 +1 @@
add more detail to logging regarding "More than one row matched" error

View File

@ -850,9 +850,9 @@ class SQLBaseStore(object):
rowcount = cls._simple_update_txn(txn, table, keyvalues, updatevalues)
if rowcount == 0:
raise StoreError(404, "No row found")
raise StoreError(404, "No row found (%s)" % (table,))
if rowcount > 1:
raise StoreError(500, "More than one row matched")
raise StoreError(500, "More than one row matched (%s)" % (table,))
@staticmethod
def _simple_select_one_txn(txn, table, keyvalues, retcols,
@ -869,9 +869,9 @@ class SQLBaseStore(object):
if not row:
if allow_none:
return None
raise StoreError(404, "No row found")
raise StoreError(404, "No row found (%s)" % (table,))
if txn.rowcount > 1:
raise StoreError(500, "More than one row matched")
raise StoreError(500, "More than one row matched (%s)" % (table,))
return dict(zip(retcols, row))
@ -903,9 +903,9 @@ class SQLBaseStore(object):
txn.execute(sql, list(keyvalues.values()))
if txn.rowcount == 0:
raise StoreError(404, "No row found")
raise StoreError(404, "No row found (%s)" % (table,))
if txn.rowcount > 1:
raise StoreError(500, "more than one row matched")
raise StoreError(500, "More than one row matched (%s)" % (table,))
def _simple_delete(self, table, keyvalues, desc):
return self.runInteraction(