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

flask: don't override code of already handled errors #409

Merged
merged 2 commits into from
Jan 31, 2018
Merged

Conversation

clutchski
Copy link
Contributor

@clutchski clutchski commented Jan 30, 2018

This is a refactoring of how we handle flask requests. We don't use
signals to teardown requests and instead use the teardown_request
handler. This always runs so it's a more reliable way of closing the
request. Signals are only used to annotate spans that received an error
(which a user may handler), and not to finish requests that may have been
successful.

This also reduces the difference between signal enabled and disabled
mode which is nice.

This should fix #390.

palazzem
palazzem previously approved these changes Jan 31, 2018
Copy link

@palazzem palazzem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Since it doesn't introduce any change the way the API is built, we're going to ship this one in the next bugfix release.

"""
# when we teardown the span, ensure we have a clean slate.
span = getattr(g, 'flask_datadog_span', None)
setattr(g, 'flask_datadog_span', None)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

This is a refactoring of how we handle flask requests. We don't use
signals to teardown requests and instead use the `teardown_request`
handler. This always runs so it's a more reliable way of closing the
request. Signals are only used to annotate spans that received an error
(which a user may handler).

This also reduces the difference between signal enabled and disabled
mode which is nice.

This should fix #390.
@palazzem
Copy link

This PR includes now #410 as a generic improvement.

@palazzem palazzem added this to the 0.10.1 milestone Jan 31, 2018
@palazzem palazzem merged commit a853f1b into master Jan 31, 2018
@palazzem palazzem deleted the flask-errs branch January 31, 2018 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect Error Handling in Flask
2 participants