Skip to content
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 30 commits into from
Feb 17, 2022

Conversation

imjoehaines
Copy link
Member

Goal

Merging caused by exceptions into next for the next release

drestrepom and others added 29 commits November 26, 2021 07:30
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
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
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Tom Longridge <tom@bugsnag.com>
@imjoehaines imjoehaines merged commit c0451ba into next Feb 17, 2022
@imjoehaines imjoehaines deleted the integration/caused-by-exceptions branch February 17, 2022 17:16
@imjoehaines imjoehaines mentioned this pull request Feb 17, 2022
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.

None yet

3 participants