diff options
author | Erik Johnston <erik@matrix.org> | 2021-07-15 10:35:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-15 10:35:46 +0100 |
commit | 7695ca06187bb6742ed74c5ae060c48a08af99ce (patch) | |
tree | 26282ea6de903cb27bcd2a586252df7ca6f4d79f /synapse/handlers/room_list.py | |
parent | doc: Add delegation example to the caddy reverse proxy section (#10368) (diff) | |
download | synapse-7695ca06187bb6742ed74c5ae060c48a08af99ce.tar.xz |
Fix a number of logged errors caused by remote servers being down. (#10400)
Diffstat (limited to 'synapse/handlers/room_list.py')
-rw-r--r-- | synapse/handlers/room_list.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/synapse/handlers/room_list.py b/synapse/handlers/room_list.py index 5e3ef7ce3a..c6bfa5451f 100644 --- a/synapse/handlers/room_list.py +++ b/synapse/handlers/room_list.py @@ -20,7 +20,12 @@ import msgpack from unpaddedbase64 import decode_base64, encode_base64 from synapse.api.constants import EventTypes, HistoryVisibility, JoinRules -from synapse.api.errors import Codes, HttpResponseException +from synapse.api.errors import ( + Codes, + HttpResponseException, + RequestSendFailed, + SynapseError, +) from synapse.types import JsonDict, ThirdPartyInstanceID from synapse.util.caches.descriptors import cached from synapse.util.caches.response_cache import ResponseCache @@ -417,14 +422,17 @@ class RoomListHandler(BaseHandler): repl_layer = self.hs.get_federation_client() if search_filter: # We can't cache when asking for search - return await repl_layer.get_public_rooms( - server_name, - limit=limit, - since_token=since_token, - search_filter=search_filter, - include_all_networks=include_all_networks, - third_party_instance_id=third_party_instance_id, - ) + try: + return await repl_layer.get_public_rooms( + server_name, + limit=limit, + since_token=since_token, + search_filter=search_filter, + include_all_networks=include_all_networks, + third_party_instance_id=third_party_instance_id, + ) + except (RequestSendFailed, HttpResponseException): + raise SynapseError(502, "Failed to fetch room list") key = ( server_name, |