This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Repository navigation
Handle HttpResponseException more safely for federated groups - #3969
Merged
turt2live merged 8 commits intoOct 23, 2018
Merged
Conversation
richvdh
suggested changes
Sep 27, 2018
richvdh
left a comment
Member
There was a problem hiding this comment.
could we have a sytest please?
| e = failure.value | ||
| if e.code >= 400 and e.code < 500: | ||
| raise SynapseError(e.code, e.msg) | ||
| failure.raiseException() |
Member
There was a problem hiding this comment.
I think you can just return failure here.
| failure.trap(HttpResponseException) | ||
| e = failure.value | ||
| if e.code >= 400 and e.code < 500: | ||
| raise SynapseError(e.code, e.msg) |
Member
There was a problem hiding this comment.
note that HttpResponseException has a to_synapse_error method which you probably want here.
| def h(failure): | ||
| failure.trap(HttpResponseException) | ||
| e = failure.value | ||
| if e.code >= 400 and e.code < 500: |
Member
There was a problem hiding this comment.
I think I'd like us to be conservative about which error codes we pass through here; can you start with if e.code == 403 and we'll work up from there?
Member
|
(otherwise it looks sensible to me) |
Member
|
(CI is failing due to pep8/import sorting) |
Member
Author
|
I'll work on sytests next week alongside the other PRs I have. |
Member
Author
|
Have made a sytest: matrix-org/sytest#512 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This doesn't feel right, but I think it's in the right direction? This fixes element-hq/element-web#7204 although it does so by trapping all 4xx errors and re-throwing them for synapse to handle differently, specifically on the group API.
Riot already has the required bits for handling the 403, but synapse currently returns a 500 instead. See element-hq/element-web#7204 for details.
Sytest: matrix-org/sytest#512