Skip to content

Commit 945cd94

Browse files
committed
move setting span to _capture_exception
1 parent 0e66448 commit 945cd94

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sentry_sdk/integrations/huggingface_hub.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ def setup_once() -> None:
5050
)
5151

5252

53-
def _capture_exception(exc: "Any") -> None:
53+
def _capture_exception(exc: "Any", span: "Any" = None) -> None:
54+
if span is not None:
55+
span.set_status(SPANSTATUS.INTERNAL_ERROR)
5456
event, hint = event_from_exception(
5557
exc,
5658
client_options=sentry_sdk.get_client().options,
@@ -126,8 +128,7 @@ def new_huggingface_task(*args: "Any", **kwargs: "Any") -> "Any":
126128
except Exception as e:
127129
exc_info = sys.exc_info()
128130
with capture_internal_exceptions():
129-
_capture_exception(e)
130-
span.set_status(SPANSTATUS.INTERNAL_ERROR)
131+
_capture_exception(e, span)
131132
span.__exit__(None, None, None)
132133
reraise(*exc_info)
133134

0 commit comments

Comments
 (0)