Skip to content

Avoid swallowing flask control-flow exceptions#158

Merged
SergeyKanzhelev merged 2 commits intomicrosoft:developfrom
CatalystCode:fix-flask-exception-logger
Mar 18, 2019
Merged

Avoid swallowing flask control-flow exceptions#158
SergeyKanzhelev merged 2 commits intomicrosoft:developfrom
CatalystCode:fix-flask-exception-logger

Conversation

@c-w
Copy link
Contributor

@c-w c-w commented Mar 18, 2019

The Flask 1.0 release changed the semantics of @app.errorhandler(Exception).

Previously, this feature would catch application internal exceptions only. Since the Flask 1.0 release, this now catches all exceptions, including werkzeug's HTTPException which is used internally by Flask for control flow, e.g. 404 not found, 403 forbidden, etc. The side-effect of this change is that the AppInsights exception handler now translated these control flow exceptions into uncaught exceptions, i.e. HTTP 500 errors.

This change makes the AppInsights exception handler more robust to no longer swallow the control-flow exceptions.

Resolves #124

c-w and others added 2 commits March 18, 2019 13:46
The Flask 1.0 release changed the semantics of
`@app.errorhandler(Exception)`.

Previously, this feature would catch application internal exceptions
only. Since the Flask 1.0 release, this now catches all exceptions,
including werkzeug's HTTPException which is used internally by Flask for
control flow, e.g. 404 not found, 403 forbidden, etc. The side-effect of
this change is that the AppInsights exception handler now translated
these control flow exceptions into uncaught exceptions, i.e. HTTP 500
errors.
@SergeyKanzhelev SergeyKanzhelev merged commit 037dbed into microsoft:develop Mar 18, 2019
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.

2 participants