Skip to content

feat: Enhance dendrite error messaging#2117

Merged
thealligatorking merged 7 commits intostagingfrom
feat/gus/enhance-dendrite-error-messaging
Jul 18, 2024
Merged

feat: Enhance dendrite error messaging#2117
thealligatorking merged 7 commits intostagingfrom
feat/gus/enhance-dendrite-error-messaging

Conversation

@thealligatorking
Copy link
Contributor

Summary

  • Extends error messages with granular status codes and messages.

@thewhaleking thewhaleking requested a review from a team July 11, 2024 12:30
Comment on lines +31 to +39
DENDRITE_ERROR_MAPPING: Dict[Type[Exception], tuple] = {
aiohttp.ClientConnectorError: ("503", "Service unavailable"),
asyncio.TimeoutError: ("408", "Request timeout"),
aiohttp.ClientResponseError: (None, "Client response error"),
aiohttp.ClientPayloadError: ("400", "Payload error"),
aiohttp.ClientError: ("500", "Client error"),
aiohttp.ServerTimeoutError: ("504", "Server timeout error"),
aiohttp.ServerDisconnectedError: ("503", "Service disconnected"),
aiohttp.ServerConnectionError: ("503", "Service connection error"),
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm totally fine with the hard-coding here, but just for future reference, the error message is embedded in the docstring, so like aiohttp.ServerTimeoutError.__doc__.

Copy link
Collaborator

@basfroman basfroman left a comment

Choose a reason for hiding this comment

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

Left no blocking comment, but LGTM

if status_code:
synapse.dendrite.status_code = status_code # type: ignore
elif isinstance(exception, aiohttp.ClientResponseError):
synapse.dendrite.status_code = str(exception.code) # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

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

code is deprecated for exactions. we need to use status instead of this in the future.

@thealligatorking thealligatorking merged commit 2e66eee into staging Jul 18, 2024
@ibraheem-abe ibraheem-abe mentioned this pull request Aug 23, 2024
@thewhaleking thewhaleking deleted the feat/gus/enhance-dendrite-error-messaging branch October 2, 2024 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants