diff options
author | Travis Ralston <travpc@gmail.com> | 2018-10-12 14:53:30 -0600 |
---|---|---|
committer | Travis Ralston <travpc@gmail.com> | 2018-10-12 14:53:30 -0600 |
commit | 7bb651de6a29e4b261b67aace1e0d5e4286b2e69 (patch) | |
tree | b09e6fde076f87eacc709f1d3414b3252f434aad /synapse | |
parent | Merge branch 'develop' into travis/fix-federated-group-requests (diff) | |
download | synapse-7bb651de6a29e4b261b67aace1e0d5e4286b2e69.tar.xz |
More sane handling of group errors and pep8
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/handlers/groups_local.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/synapse/handlers/groups_local.py b/synapse/handlers/groups_local.py index 68de8a8e53..66da6edad1 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, HttpResponseException) +from synapse.api.errors import (HttpResponseException, SynapseError) from synapse.types import get_domain_from_id logger = logging.getLogger(__name__) @@ -40,12 +40,13 @@ def _create_rerouter(func_name): d = getattr(self.transport_client, func_name)( destination, group_id, *args, **kwargs ) + def h(failure): failure.trap(HttpResponseException) e = failure.value - if e.code >= 400 and e.code < 500: - raise SynapseError(e.code, e.msg) - failure.raiseException() + if e.code == 403: + raise e.to_synapse_error() + return failure d.addErrback(h) return d return f |