mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Merge pull request #5810 from matrix-org/erikj/no_server_reachable
Return 502 not 500 when failing to reach any remote server.
This commit is contained in:
commit
d55bc4a8bf
1
changelog.d/5810.misc
Normal file
1
changelog.d/5810.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Return 502 not 500 when failing to reach any remote server.
|
@ -511,9 +511,8 @@ class FederationClient(FederationBase):
|
|||||||
The [Deferred] result of callback, if it succeeds
|
The [Deferred] result of callback, if it succeeds
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
SynapseError if the chosen remote server returns a 300/400 code.
|
SynapseError if the chosen remote server returns a 300/400 code, or
|
||||||
|
no servers were reachable.
|
||||||
RuntimeError if no servers were reachable.
|
|
||||||
"""
|
"""
|
||||||
for destination in destinations:
|
for destination in destinations:
|
||||||
if destination == self.server_name:
|
if destination == self.server_name:
|
||||||
@ -538,7 +537,7 @@ class FederationClient(FederationBase):
|
|||||||
except Exception:
|
except Exception:
|
||||||
logger.warn("Failed to %s via %s", description, destination, exc_info=1)
|
logger.warn("Failed to %s via %s", description, destination, exc_info=1)
|
||||||
|
|
||||||
raise RuntimeError("Failed to %s via any server" % (description,))
|
raise SynapseError(502, "Failed to %s via any server" % (description,))
|
||||||
|
|
||||||
def make_membership_event(
|
def make_membership_event(
|
||||||
self, destinations, room_id, user_id, membership, content, params
|
self, destinations, room_id, user_id, membership, content, params
|
||||||
|
Loading…
Reference in New Issue
Block a user