Skip to content

Commit

Permalink
Merge pull request #81 from benhiller/handle_error_fix
Browse files Browse the repository at this point in the history
[middleware] Don't try to access self.state.span in handle_error of Flask DB middleware if there is no current_app
  • Loading branch information
tredman authored Sep 10, 2019
2 parents f5ad3c8 + 000e4ce commit ec05745
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions beeline/middleware/flask/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ def after_cursor_execute(self, conn, cursor, statement, parameters, context, exe
self.state.span = None

def handle_error(self, context):
if not current_app:
return

beeline.add_context_field("db.error", beeline.internal.stringify_exception(context.original_exception))
if self.state.span:
beeline.finish_span(self.state.span)
Expand Down

0 comments on commit ec05745

Please sign in to comment.