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

Fix exception reporting due to HTTP request errors. #7556

Merged
merged 2 commits into from
May 22, 2020

Conversation

erikjohnston
Copy link
Member

These are business as usual errors, rather than stuff we want to log at error.

These are business as usual errors, rather than stuff we want to log at
error.
Comment on lines +210 to +212
raise e.to_synapse() from e
except RequestSendFailed as e:
raise SynapseError(502, "Failed to talk to master") from e
Copy link
Member

Choose a reason for hiding this comment

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

"from e" is implicit when inside an except block... maybe it's worth including for clarity?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

hrm ISWYM, they seem to do slightly different things. How does the result differ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I mean, that is slightly more interesting question. TBH I was mostly going by the fact that we bother using six.raise_from elsewhere when wrapping like this.

Copy link
Member Author

@erikjohnston erikjohnston May 22, 2020

Choose a reason for hiding this comment

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

I wonder if it gets rid of some of the return deferred exceptions as we explicitly set the __cause__ and so ignore the implicit __context__?

Copy link
Member Author

Choose a reason for hiding this comment

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

Asi in, I think the intention is that the implicit style is for "argh we failed to process this exception and raised another one" while the explicit style is for wrapping exceptions.

Copy link
Member

Choose a reason for hiding this comment

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

You might be right. In which case, there are probably lots of other places we should be doing the same.

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

seems plausible

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants