Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

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

Merged
merged 3 commits into from
Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/4234.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add more detail to logging regarding "More than one row matched" error
12 changes: 6 additions & 6 deletions synapse/storage/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,9 +849,9 @@ def _simple_update_one_txn(cls, txn, table, keyvalues, updatevalues):
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,
Expand All @@ -868,9 +868,9 @@ def _simple_select_one_txn(txn, table, keyvalues, retcols,
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))

Expand Down Expand Up @@ -902,9 +902,9 @@ def _simple_delete_one_txn(txn, table, keyvalues):

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(
Expand Down