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

Make minor clarifications to the error messages given when we fail to join a room via any server. #13160

Merged
merged 6 commits into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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/13160.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make minor clarifications to the error messages given when we fail to join a room via any server.
8 changes: 7 additions & 1 deletion synapse/federation/federation_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,12 @@ async def _try_destination_list(
if failover_errcodes is None:
failover_errcodes = ()

if not destinations:
# Give a bit of a clearer message if no servers were specified at all.
raise SynapseError(
502, f"Failed to {description} via any server: No servers specified."
)

for destination in destinations:
if destination == self.server_name:
continue
Expand Down Expand Up @@ -735,7 +741,7 @@ async def _try_destination_list(
"Failed to %s via %s", description, destination, exc_info=True
)

raise SynapseError(502, "Failed to %s via any server" % (description,))
raise SynapseError(502, f"Failed to {description} via any server")

async def make_membership_event(
self,
Expand Down
6 changes: 5 additions & 1 deletion synapse/handlers/room_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,11 @@ async def _remote_join(
]

if len(remote_room_hosts) == 0:
raise SynapseError(404, "No known servers")
raise SynapseError(
404,
"Can't join remote room because no servers "
"that are in the room have been provided.",
)

check_complexity = self.hs.config.server.limit_remote_rooms.enabled
if (
Expand Down