diff options
author | Erik Johnston <erik@matrix.org> | 2017-03-23 13:48:30 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-03-23 13:48:30 +0000 |
commit | 6ebe2d23b1a366199e585dda671c9086c145e6b9 (patch) | |
tree | c84af05eb7d9307444acfe7e8c92c4d648ebc205 /synapse | |
parent | Don't user upsert to persist new one time keys (diff) | |
download | synapse-6ebe2d23b1a366199e585dda671c9086c145e6b9.tar.xz |
Raise a more helpful exception
Diffstat (limited to '')
-rw-r--r-- | synapse/storage/end_to_end_keys.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/storage/end_to_end_keys.py b/synapse/storage/end_to_end_keys.py index 77bb9b0657..85340746c7 100644 --- a/synapse/storage/end_to_end_keys.py +++ b/synapse/storage/end_to_end_keys.py @@ -14,6 +14,8 @@ # limitations under the License. from twisted.internet import defer +from synapse.api.errors import SynapseError + from canonicaljson import encode_canonical_json import ujson as json @@ -150,8 +152,8 @@ class EndToEndKeyStore(SQLBaseStore): if key_id in existing_key_map: ex_algo, ex_bytes = existing_key_map[key_id] if algorithm != ex_algo or json_bytes != ex_bytes: - raise Exception( - "One time key with key_id %r already exists" % (key_id,) + raise SynapseError( + 400, "One time key with key_id %r already exists" % (key_id,) ) else: new_keys.append((algorithm, key_id, json_bytes)) |