diff --git a/changelog.d/4234.misc b/changelog.d/4234.misc new file mode 100644 index 0000000000000000000000000000000000000000..b5a01d38af969d5c4586238afa08cb1a41fdcdaf --- /dev/null +++ b/changelog.d/4234.misc @@ -0,0 +1 @@ +add more detail to logging regarding "More than one row matched" error \ No newline at end of file diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py index 38e7d263658036731149a6cbe80dd85b8a936f1c..1d3069b143506ee8c769806257373b62d6093e7c 100644 --- a/synapse/storage/_base.py +++ b/synapse/storage/_base.py @@ -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(