mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Handle HttpResponseException more safely for federated groups
This commit is contained in:
parent
219606a6ed
commit
b4c3bc1734
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user