Skip to content

Commit dcefe38

Browse files
Avoid reporting false-positive StopAsyncIteration in the asyncio integration (#4741)
If a coroutine exits an async loop by raising `AsyncStopIteration`, Sentry reports it as an error. There is no error in that case. Co-authored-by: Anton Pirker <[email protected]>
1 parent 73e2b7e commit dcefe38

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sentry_sdk/integrations/asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ async def _task_with_sentry_span_creation():
5151
):
5252
try:
5353
result = await coro
54+
except StopAsyncIteration as e:
55+
raise e from None
5456
except Exception:
5557
reraise(*_capture_exception())
5658

0 commit comments

Comments
 (0)