Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions sentry_sdk/integrations/huey.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,13 @@ def _capture_exception(exc_info):
# type: (ExcInfo) -> None
scope = sentry_sdk.get_current_scope()

if exc_info[0] in HUEY_CONTROL_FLOW_EXCEPTIONS:
scope.root_span.set_status(SPANSTATUS.ABORTED)
return
if scope.root_span is not None:
if exc_info[0] in HUEY_CONTROL_FLOW_EXCEPTIONS:
scope.root_span.set_status(SPANSTATUS.ABORTED)
return

scope.root_span.set_status(SPANSTATUS.INTERNAL_ERROR)

scope.root_span.set_status(SPANSTATUS.INTERNAL_ERROR)
event, hint = event_from_exception(
exc_info,
client_options=sentry_sdk.get_client().options,
Expand All @@ -136,8 +138,10 @@ def _sentry_execute(*args, **kwargs):
exc_info = sys.exc_info()
_capture_exception(exc_info)
reraise(*exc_info)
else:
sentry_sdk.get_current_scope().root_span.set_status(SPANSTATUS.OK)

root_span = sentry_sdk.get_current_scope().root_span
if root_span is not None:
root_span.set_status(SPANSTATUS.OK)

return result

Expand Down
3 changes: 1 addition & 2 deletions sentry_sdk/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,7 @@ def fingerprint(self, value):

@property
def root_span(self):
# type: () -> Any
# would be type: () -> Optional[Span], see https://github.com/python/mypy/issues/3004
# type: () -> Optional[Span]
"""Return the root span in the scope, if any."""

# there is no span/transaction on the scope
Expand Down
Loading