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

Fix a number of logged errors caused by remote servers being down. #10400

Merged
merged 7 commits into from
Jul 15, 2021
Merged
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion synapse/handlers/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
CodeMessageException,
Codes,
NotFoundError,
RequestSendFailed,
ShadowBanError,
StoreError,
SynapseError,
Expand Down Expand Up @@ -252,12 +253,14 @@ async def get_association(self, room_alias: RoomAlias) -> JsonDict:
retry_on_dns_fail=False,
ignore_backoff=True,
)
except RequestSendFailed:
raise SynapseError(502, "Failed to fetch alias")
except CodeMessageException as e:
logging.warning("Error retrieving alias")
if e.code == 404:
fed_result = None
else:
raise
raise SynapseError(502, "Failed to fetch alias")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we log the original error as well? (or maybe it's already logged as part of the HTTP client logs, I can't remember)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Q. We should log response success/errors in the http clients, so I don't think its necessary here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, re-raising here implicitly adds from e, so the traceback of the original exception will be available to anyone who catches it.


if fed_result and "room_id" in fed_result and "servers" in fed_result:
room_id = fed_result["room_id"]
Expand Down