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

Return 502 not 500 when failing to reach any remote server. #5810

Merged
merged 2 commits into from
Aug 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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