-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Caused by exceptions integration branch #314
Merged
Merged
Conversation
This file contains 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
Problem: - bugsnag supports a full stacktrace (chain of exceptions) - bugsnag-python only throws the first exception in the exception chain Solution: - get the exceptions chain and convert them - send multiple exceptions to bugsnag
Allow multiple exceptions
When using 'raise x from None', Python sets a __suppress_context__ property on exception x to True This indicates that the __context__ property should be ignored, so we stop traversing the exception chain at this point
Traversing the exception chain broke this use-case, which could cause issues for users even if we didn't intend to support it
Add initial tests for caused by exceptions
Honour the `__suppress_context__` property
Fix backwards compatibility breaks in caused by exceptions implementation
Refactor caused by exceptions to match other platforms
Check the chain of exceptions for ignored classes
Add tests for caused by exceptions using the capture decorator/context manager
Previously we used `sys.exc_info` for handled errors (unless the `traceback` option was provided), which may not be very useful - it shows where `notify` was called, not where the error was raised Since Python 3, exception objects have a `__traceback__` attribute that fixes this Now we get the traceback in the following order of priority: 1. the `traceback` option 2. the `exception.__traceback__` attribute 3. `sys.exc_info` We still need to read `sys.exc_info` for cases where a non-exception has been provided to `notify` - this isn't really a supported use-case but we do currently handle this
Add tests for chained exceptions in integrations
Improve stacktraces for handled errors
Co-authored-by: Tom Longridge <tom@bugsnag.com>
tomlongridge
approved these changes
Feb 17, 2022
Merged
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.
Goal
Merging caused by exceptions into
next
for the next release