Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
Handle optional url_rule in Flask (fixes GH-863)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Sep 19, 2016
1 parent 521f272 commit 920d1b9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions raven/contrib/flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ def get_http_info_with_retriever(self, request, retriever=None):
def before_request(self, *args, **kwargs):
self.last_event_id = None

self.client.transaction.push(request.url_rule.rule)
if request.url_rule:
self.client.transaction.push(request.url_rule.rule)

try:
self.client.http_context(self.get_http_info(request))
Expand All @@ -232,7 +233,8 @@ def after_request(self, sender, response, *args, **kwargs):
if self.last_event_id:
response.headers['X-Sentry-ID'] = self.last_event_id
self.client.context.clear()
self.client.transaction.pop(request.url_rule.rule)
if request.url_rule:
self.client.transaction.pop(request.url_rule.rule)
return response

def init_app(self, app, dsn=None, logging=None, level=None,
Expand Down

0 comments on commit 920d1b9

Please sign in to comment.