bugsnag / bugsnag-python

Official BugSnag error monitoring and error reporting for django, flask, tornado and other python apps.
https://docs.bugsnag.com/platforms/python/
MIT License
84 stars 42 forks source link

Honour the `__suppress_context__` property #307

Closed imjoehaines closed 2 years ago

imjoehaines commented 2 years ago

Goal

When using raise x from None, Python sets x.__suppress_context__ to True. This is intended to tell anyone traversing the exception chain to ignore the __context__ property, but we were ignoring this

This PR will stop traversing the exception chain when an exception has __suppress_context__ set

This was added in PEP 415, with some background in PEP 409

In this small refactor, I noticed we'd broken the case where notify is passed a string. This isn't really intended to be supported, but I've fixed it and added a test as it could be a BC break and was trivial to solve