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

Don't try to build request data if outside request context #68

Merged
merged 1 commit into from
Sep 3, 2015

Conversation

kshep
Copy link
Contributor

@kshep kshep commented Sep 3, 2015

When using the rollbar log handler in Flask apps, if you try to report errors outside the request context (e.g. in background workers), you'll see RuntimeErrors in your local logs as rollbar tries to populate the request data for the error report.

This commit cleans up the logs by suppressing that exception.

@brianr
Copy link
Member

brianr commented Sep 3, 2015

Is there a reasonable test we could write for this?

@kshep
Copy link
Contributor Author

kshep commented Sep 3, 2015

Seems like trying to add in a test for non-request context Flask errors is pretty specific, given that we don't have any existing framework specific-tests in the suite. Maybe someday...

brianr added a commit that referenced this pull request Sep 3, 2015
Don't try to build request data if outside request context
@brianr brianr merged commit 0119e1b into master Sep 3, 2015
actual_request = request._get_current_object()
try:
actual_request = request._get_current_object()
except RuntimeError:
Copy link
Contributor

Choose a reason for hiding this comment

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

A comment here would be helpful for maintenance.

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.

3 participants