summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorTravis Ralston <travpc@gmail.com>2018-09-26 13:26:45 -0600
committerTravis Ralston <travpc@gmail.com>2018-09-26 13:48:04 -0600
commitb4c3bc17343833205d3bb00009074734edce667a (patch)
treecc6d3968a914e45e2d9ce498e5fb5daabdfcc9e1 /synapse
parentFix exception documentation in matrixfederationclient.py (diff)
downloadsynapse-b4c3bc17343833205d3bb00009074734edce667a.tar.xz
Handle HttpResponseException more safely for federated groups
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/groups_local.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/synapse/handlers/groups_local.py b/synapse/handlers/groups_local.py
index 53e5e2648b..e36f22f128 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 (SynapseError, HttpResponseException)
 from synapse.types import get_domain_from_id
 
 logger = logging.getLogger(__name__)
@@ -37,9 +37,18 @@ def _create_rerouter(func_name):
             )
         else:
             destination = get_domain_from_id(group_id)
-            return getattr(self.transport_client, func_name)(
+            logger.info("Triggering call")
+            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()
+            d.addErrback(h)
+            return d
     return f