Skip to content
Snippets Groups Projects
Commit 664c81e8 authored by Hubert Chathi's avatar Hubert Chathi
Browse files

return proper error codes for some 404s

parent ef43a03f
No related branches found
No related tags found
No related merge requests found
...@@ -267,7 +267,7 @@ class E2eRoomKeysHandler(object): ...@@ -267,7 +267,7 @@ class E2eRoomKeysHandler(object):
version(str): Optional; if None gives the most recent version version(str): Optional; if None gives the most recent version
otherwise a historical one. otherwise a historical one.
Raises: Raises:
StoreError: code 404 if the requested backup version doesn't exist NotFoundError: if the requested backup version doesn't exist
Returns: Returns:
A deferred of a info dict that gives the info about the new version. A deferred of a info dict that gives the info about the new version.
...@@ -279,7 +279,13 @@ class E2eRoomKeysHandler(object): ...@@ -279,7 +279,13 @@ class E2eRoomKeysHandler(object):
""" """
with (yield self._upload_linearizer.queue(user_id)): 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.returnValue(res)
@defer.inlineCallbacks @defer.inlineCallbacks
...@@ -290,8 +296,14 @@ class E2eRoomKeysHandler(object): ...@@ -290,8 +296,14 @@ class E2eRoomKeysHandler(object):
user_id(str): the user whose current backup version we're deleting user_id(str): the user whose current backup version we're deleting
version(str): the version id of the backup being deleted version(str): the version id of the backup being deleted
Raises: 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)): 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment