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

Avoid swallowing flask control-flow exceptions #158

Merged

Conversation

Projects
None yet
2 participants
@c-w
Copy link
Member

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

Avoid swallowing flask control-flow exceptions
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.

@c-w c-w force-pushed the CatalystCode:fix-flask-exception-logger branch from c67fd30 to d5ca426 Mar 18, 2019

@SergeyKanzhelev SergeyKanzhelev merged commit 037dbed into microsoft:develop Mar 18, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla All CLA requirements met.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.