Skip to content

Commit 916df4a

Browse files
committed
move span status setting to exit()
1 parent 945cd94 commit 916df4a

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

sentry_sdk/integrations/huggingface_hub.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import sentry_sdk
77
from sentry_sdk.ai.monitoring import record_token_usage
88
from sentry_sdk.ai.utils import set_data_normalized
9-
from sentry_sdk.consts import OP, SPANDATA, SPANSTATUS
9+
from sentry_sdk.consts import OP, SPANDATA
1010
from sentry_sdk.integrations import DidNotEnable, Integration
1111
from sentry_sdk.scope import should_send_default_pii
1212
from sentry_sdk.utils import (
@@ -50,9 +50,7 @@ def setup_once() -> None:
5050
)
5151

5252

53-
def _capture_exception(exc: "Any", span: "Any" = None) -> None:
54-
if span is not None:
55-
span.set_status(SPANSTATUS.INTERNAL_ERROR)
53+
def _capture_exception(exc: "Any") -> None:
5654
event, hint = event_from_exception(
5755
exc,
5856
client_options=sentry_sdk.get_client().options,
@@ -128,8 +126,8 @@ def new_huggingface_task(*args: "Any", **kwargs: "Any") -> "Any":
128126
except Exception as e:
129127
exc_info = sys.exc_info()
130128
with capture_internal_exceptions():
131-
_capture_exception(e, span)
132-
span.__exit__(None, None, None)
129+
_capture_exception(e)
130+
span.__exit__(*exc_info)
133131
reraise(*exc_info)
134132

135133
# Output attributes

0 commit comments

Comments
 (0)