diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | raven/contrib/flask.py | 11 |
2 files changed, 11 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 25e410b..e7c8a73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ------ * [Core] Fixed stackframes in some situations being in inverse order. +* [Flask] Fix wrong exception handling logic (accidentally relied on Flask internals). 6.9.0 (2018-05-30) ------------------ diff --git a/raven/contrib/flask.py b/raven/contrib/flask.py index 40c7fb3..0a3f750 100644 --- a/raven/contrib/flask.py +++ b/raven/contrib/flask.py @@ -136,7 +136,16 @@ class Sentry(object): if not self.client: return - self.captureException(exc_info=kwargs.get('exc_info')) + # got_request_exception signal passes the exception as 'exception' + exception = kwargs.get('exception') + if exception is not None and hasattr(exception, '__traceback__'): + # On Python 3 we can contruct the exc_info via __traceback__ + exc_info = (type(exception), exception, exception.__traceback__) + else: + # The user may call the method with 'exc_info' manually + exc_info = kwargs.get('exc_info') + + self.captureException(exc_info=exc_info) def get_user_info(self, request): """ |