summary refs log tree commit diff
path: root/synapse/rest/client/v2_alpha
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2018-09-13 17:02:59 +0100
committerDavid Baker <dave@matrix.org>2018-09-13 17:02:59 +0100
commitbc74925c5b94f0c02603297d4ccb7e05008d5124 (patch)
tree631363f6ccd5870c44135fdc331da68de32c323b /synapse/rest/client/v2_alpha
parenttry to make flake8 and isort happy (diff)
downloadsynapse-bc74925c5b94f0c02603297d4ccb7e05008d5124.tar.xz
WIP e2e key backups
Continues from uhoreg's branch

This just fixed the errcode on /room_keys/version if no backup and
updates the schema delta to be on the latest so it gets run
Diffstat (limited to 'synapse/rest/client/v2_alpha')
-rw-r--r--synapse/rest/client/v2_alpha/room_keys.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/synapse/rest/client/v2_alpha/room_keys.py b/synapse/rest/client/v2_alpha/room_keys.py
index 1ed18e986f..ea114bc8b4 100644
--- a/synapse/rest/client/v2_alpha/room_keys.py
+++ b/synapse/rest/client/v2_alpha/room_keys.py
@@ -17,7 +17,7 @@ import logging
 
 from twisted.internet import defer
 
-from synapse.api.errors import SynapseError
+from synapse.api.errors import SynapseError, Codes
 from synapse.http.servlet import (
     RestServlet,
     parse_json_object_from_request,
@@ -324,9 +324,15 @@ class RoomKeysVersionServlet(RestServlet):
         requester = yield self.auth.get_user_by_req(request, allow_guest=False)
         user_id = requester.user.to_string()
 
-        info = yield self.e2e_room_keys_handler.get_version_info(
-            user_id, version
-        )
+        try:
+            info = yield self.e2e_room_keys_handler.get_version_info(
+                user_id, version
+            )
+        except SynapseError as e:
+            if e.code == 404:
+                e.errcode = Codes.NOT_FOUND
+                e.msg = "No backup found"
+                raise e
         defer.returnValue((200, info))
 
     @defer.inlineCallbacks