fix(wsgi): Log SystemExit (with non-zero exit code) and KeyboardInterrupt#380
Merged
Conversation
…I middleware Neither SystemExit nor KeyboardInterrupt subclass Exception, so we must explicitly handle these two exception classes in addition to Exception in the WSGI middleware. This is notably a direct port from raven-python: - https://github.com/getsentry/raven-python/blob/master/raven/middleware.py - https://github.com/getsentry/raven-python/blob/master/tests/middleware/tests.py Fixes: getsentryGH-379
untitaker
requested changes
May 30, 2019
Member
untitaker
left a comment
There was a problem hiding this comment.
Makes sense. Instead of having so many duplicated except blocks, could you catch BaseException instead of Exception everywhere, and have the special logic for SystemExit in _capture_exception?
Other than that lgtm
From the python docs: > If the value is an integer, it specifies the system exit status (passed to C’s > exit() function); if it is None, the exit status is zero; if it has another > type (such as a string), the object’s value is printed and the exit status is > one.
Crash introduced in getsentryGH-270
Contributor
Author
|
@untitaker : thanks, back to you! |
untitaker
requested changes
May 31, 2019
Member
untitaker
left a comment
There was a problem hiding this comment.
one change necessary, also please make sure that CI passes (see CONTRIBUTING.md)
| pass | ||
| except Exception: | ||
| reraise(*_capture_exception(self._hub)) | ||
| except BaseException: |
Contributor
Author
looks like it was failing from zeus, so hopefully merging in master takes care of that 🤞🏾 |
untitaker
reviewed
May 31, 2019
untitaker
approved these changes
Jun 1, 2019
Member
|
Thanks! |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Neither SystemExit nor KeyboardInterrupt subclass Exception, so we must
explicitly handle these two exception classes in addition to Exception in the
WSGI middleware.
This is notably a direct port from raven-python:
Fixes: GH-379
There are notably 3 places an exception could be raised, but it looks like we're only
testing one case. If we want to test the other two, would appreciate advice 🙏🏾.