summary refs log tree commit diff
path: root/synapse/api
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-08-01 13:47:07 +0100
committerRichard van der Hoff <richard@matrix.org>2018-08-01 16:02:38 +0100
commitfa7dc889f19f581e81624245ce7820525066eff3 (patch)
tree9f09fae4e8f077542bfdccf806a12b45d09c6cd7 /synapse/api
parentFactor out exception handling in federation_client (diff)
downloadsynapse-fa7dc889f19f581e81624245ce7820525066eff3.tar.xz
Be more careful which errors we send back over the C-S API
We really shouldn't be sending all CodeMessageExceptions back over the C-S API;
it will include things like 401s which we shouldn't proxy.

That means that we need to explicitly turn a few HttpResponseExceptions into
SynapseErrors in the federation layer.

The effect of the latter is that the matrix errcode will get passed through
correctly to calling clients, which might help with some of the random
M_UNKNOWN errors when trying to join rooms.
Diffstat (limited to 'synapse/api')
-rw-r--r--synapse/api/errors.py11
1 files changed, 0 insertions, 11 deletions
diff --git a/synapse/api/errors.py b/synapse/api/errors.py
index 6074df292f..cf48829c8b 100644
--- a/synapse/api/errors.py
+++ b/synapse/api/errors.py
@@ -69,9 +69,6 @@ class CodeMessageException(RuntimeError):
         self.code = code
         self.msg = msg
 
-    def error_dict(self):
-        return cs_error(self.msg)
-
 
 class MatrixCodeMessageException(CodeMessageException):
     """An error from a general matrix endpoint, eg. from a proxied Matrix API call.
@@ -308,14 +305,6 @@ class LimitExceededError(SynapseError):
         )
 
 
-def cs_exception(exception):
-    if isinstance(exception, CodeMessageException):
-        return exception.error_dict()
-    else:
-        logger.error("Unknown exception type: %s", type(exception))
-        return {}
-
-
 def cs_error(msg, code=Codes.UNKNOWN, **kwargs):
     """ Utility method for constructing an error response for client-server
     interactions.