diff options
author | Ben Parsons <ben@bpulse.co.uk> | 2018-12-04 10:57:39 +0000 |
---|---|---|
committer | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2018-12-04 11:57:39 +0100 |
commit | b5ac0ffa0a842d99ea4ef903047cc6ca668057ed (patch) | |
tree | 836591a79105ae0dfb77e4745def75375b9d33b3 | |
parent | Fix UnicodeDecodeError when postgres is not configured in english (#4253) (diff) | |
download | synapse-b5ac0ffa0a842d99ea4ef903047cc6ca668057ed.tar.xz |
add more detail to logging regarding "More than one row matched" error (#4234)
-rw-r--r-- | changelog.d/4234.misc | 1 | ||||
-rw-r--r-- | synapse/storage/_base.py | 12 |
2 files changed, 7 insertions, 6 deletions
diff --git a/changelog.d/4234.misc b/changelog.d/4234.misc new file mode 100644 index 0000000000..b5a01d38af --- /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 38e7d26365..1d3069b143 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( |