mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-26 12:16:12 +00:00
Raise a more helpful exception
This commit is contained in:
parent
e64655c25d
commit
6ebe2d23b1
@ -14,6 +14,8 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
|
from synapse.api.errors import SynapseError
|
||||||
|
|
||||||
from canonicaljson import encode_canonical_json
|
from canonicaljson import encode_canonical_json
|
||||||
import ujson as json
|
import ujson as json
|
||||||
|
|
||||||
@ -150,8 +152,8 @@ class EndToEndKeyStore(SQLBaseStore):
|
|||||||
if key_id in existing_key_map:
|
if key_id in existing_key_map:
|
||||||
ex_algo, ex_bytes = existing_key_map[key_id]
|
ex_algo, ex_bytes = existing_key_map[key_id]
|
||||||
if algorithm != ex_algo or json_bytes != ex_bytes:
|
if algorithm != ex_algo or json_bytes != ex_bytes:
|
||||||
raise Exception(
|
raise SynapseError(
|
||||||
"One time key with key_id %r already exists" % (key_id,)
|
400, "One time key with key_id %r already exists" % (key_id,)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
new_keys.append((algorithm, key_id, json_bytes))
|
new_keys.append((algorithm, key_id, json_bytes))
|
||||||
|
Loading…
Reference in New Issue
Block a user