summary refs log tree commit diff
path: root/synapse/federation/federation_client.py
diff options
context:
space:
mode:
authorreivilibre <oliverw@matrix.org>2022-07-27 10:37:50 +0000
committerGitHub <noreply@github.com>2022-07-27 10:37:50 +0000
commit39be5bc550f2e882b4754c7d98c906d9bde8b649 (patch)
tree5174a0e60c4faf3bace0cac50257f8a0818889b3 /synapse/federation/federation_client.py
parentFix `get_pdu` asking every remote destination even after it finds an event (#... (diff)
downloadsynapse-39be5bc550f2e882b4754c7d98c906d9bde8b649.tar.xz
Make minor clarifications to the error messages given when we fail to join a room via any server. (#13160)
Diffstat (limited to 'synapse/federation/federation_client.py')
-rw-r--r--synapse/federation/federation_client.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/federation/federation_client.py b/synapse/federation/federation_client.py
index 02276ed995..6a8d76529b 100644
--- a/synapse/federation/federation_client.py
+++ b/synapse/federation/federation_client.py
@@ -725,6 +725,12 @@ class FederationClient(FederationBase):
         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
@@ -774,7 +780,7 @@ class FederationClient(FederationBase):
                     "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,