summary refs log tree commit diff
path: root/synapse/handlers/e2e_room_keys.py
diff options
context:
space:
mode:
authorHubert Chathi <hubert@uhoreg.ca>2019-02-06 17:47:22 -0500
committerHubert Chathi <hubert@uhoreg.ca>2019-02-06 17:47:22 -0500
commit664c81e8b7525bfaa5c3a7620f2f831ade0754a2 (patch)
treee5bce51c5ca20c360ef9425eed4da75b63a14c18 /synapse/handlers/e2e_room_keys.py
parentMerge pull request #4546 from matrix-org/rav/silence_critical_error_from_fede... (diff)
downloadsynapse-664c81e8b7525bfaa5c3a7620f2f831ade0754a2.tar.xz
return proper error codes for some 404s
Diffstat (limited to 'synapse/handlers/e2e_room_keys.py')
-rw-r--r--synapse/handlers/e2e_room_keys.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/synapse/handlers/e2e_room_keys.py b/synapse/handlers/e2e_room_keys.py
index 42b040375f..c5d7bf0c29 100644
--- a/synapse/handlers/e2e_room_keys.py
+++ b/synapse/handlers/e2e_room_keys.py
@@ -267,7 +267,7 @@ class E2eRoomKeysHandler(object):
             version(str): Optional; if None gives the most recent version
                 otherwise a historical one.
         Raises:
-            StoreError: code 404 if the requested backup version doesn't exist
+            NotFoundError: if the requested backup version doesn't exist
         Returns:
             A deferred of a info dict that gives the info about the new version.
 
@@ -279,7 +279,13 @@ class E2eRoomKeysHandler(object):
         """
 
         with (yield self._upload_linearizer.queue(user_id)):
-            res = yield self.store.get_e2e_room_keys_version_info(user_id, version)
+            try:
+                res = yield self.store.get_e2e_room_keys_version_info(user_id, version)
+            except StoreError as e:
+                if e.code == 404:
+                    raise NotFoundError("Unknown backup version")
+                else:
+                    raise
             defer.returnValue(res)
 
     @defer.inlineCallbacks
@@ -290,8 +296,14 @@ class E2eRoomKeysHandler(object):
             user_id(str): the user whose current backup version we're deleting
             version(str): the version id of the backup being deleted
         Raises:
-            StoreError: code 404 if this backup version doesn't exist
+            NotFoundError: if this backup version doesn't exist
         """
 
         with (yield self._upload_linearizer.queue(user_id)):
-            yield self.store.delete_e2e_room_keys_version(user_id, version)
+            try:
+                yield self.store.delete_e2e_room_keys_version(user_id, version)
+            except StoreError as e:
+                if e.code == 404:
+                    raise NotFoundError("Unknown backup version")
+                else:
+                    raise