Skip to content

Commit e2f7afc

Browse files
.
1 parent fdf770a commit e2f7afc

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

sentry_sdk/integrations/anthropic.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,6 @@ async def _wrap_asynchronous_message_iterator(
498498
Sets information received while iterating the response stream on the AI Client Span.
499499
Responsible for closing the AI Client Span, unless the span has already been closed in the close() patch.
500500
"""
501-
generator_exit = False
502501
try:
503502
async for event in iterator:
504503
# Message and content types are aliases for corresponding Raw* types, introduced in
@@ -519,14 +518,9 @@ async def _wrap_asynchronous_message_iterator(
519518

520519
_accumulate_event_data(stream, event)
521520
yield event
522-
except (
523-
GeneratorExit
524-
): # https://docs.python.org/3/reference/expressions.html#generator.close
525-
generator_exit = True
526-
raise
527521
finally:
528522
with capture_internal_exceptions():
529-
if not generator_exit and hasattr(stream, "_span"):
523+
if hasattr(stream, "_span"):
530524
_finish_streaming_span(
531525
span=stream._span,
532526
integration=stream._integration,

0 commit comments

Comments
 (0)