Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5810 from matrix-org/erikj/no_server_reachable
Browse files Browse the repository at this point in the history
Return 502 not 500 when failing to reach any remote server.
  • Loading branch information
erikjohnston authored Aug 1, 2019
2 parents 5d018d2 + 93fd3cb commit d55bc4a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog.d/5810.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Return 502 not 500 when failing to reach any remote server.
7 changes: 3 additions & 4 deletions synapse/federation/federation_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,8 @@ def _try_destination_list(self, description, destinations, callback):
The [Deferred] result of callback, if it succeeds
Raises:
SynapseError if the chosen remote server returns a 300/400 code.
RuntimeError if no servers were reachable.
SynapseError if the chosen remote server returns a 300/400 code, or
no servers were reachable.
"""
for destination in destinations:
if destination == self.server_name:
Expand All @@ -538,7 +537,7 @@ def _try_destination_list(self, description, destinations, callback):
except Exception:
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(
self, destinations, room_id, user_id, membership, content, params
Expand Down

0 comments on commit d55bc4a

Please sign in to comment.