diff options
author | Erik Johnston <erik@matrix.org> | 2018-10-25 15:25:31 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2018-10-25 15:25:31 +0100 |
commit | b94a43d5b5a949fbd67109b34cfcec925fa82fe4 (patch) | |
tree | 1e427071264b9cd23233175b3cff4684d93d6e36 /synapse/handlers/groups_local.py | |
parent | Use allow/deny (diff) | |
parent | Merge pull request #3975 from matrix-org/matthew/autocreate_autojoin (diff) | |
download | synapse-b94a43d5b5a949fbd67109b34cfcec925fa82fe4.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/alias_disallow_list
Diffstat (limited to 'synapse/handlers/groups_local.py')
-rw-r--r-- | synapse/handlers/groups_local.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/synapse/handlers/groups_local.py b/synapse/handlers/groups_local.py index 53e5e2648b..173315af6c 100644 --- a/synapse/handlers/groups_local.py +++ b/synapse/handlers/groups_local.py @@ -20,7 +20,7 @@ from six import iteritems from twisted.internet import defer -from synapse.api.errors import SynapseError +from synapse.api.errors import HttpResponseException, SynapseError from synapse.types import get_domain_from_id logger = logging.getLogger(__name__) @@ -37,9 +37,23 @@ def _create_rerouter(func_name): ) else: destination = get_domain_from_id(group_id) - return getattr(self.transport_client, func_name)( + d = getattr(self.transport_client, func_name)( destination, group_id, *args, **kwargs ) + + # Capture errors returned by the remote homeserver and + # re-throw specific errors as SynapseErrors. This is so + # when the remote end responds with things like 403 Not + # In Group, we can communicate that to the client instead + # of a 500. + def h(failure): + failure.trap(HttpResponseException) + e = failure.value + if e.code == 403: + raise e.to_synapse_error() + return failure + d.addErrback(h) + return d return f |