Skip to content

wrap finally in capture internal exceptions

0da2362
Select commit
Loading
Failed to load commit list.
Merged

fix(anthropic): Close span on GeneratorExit #5643

wrap finally in capture internal exceptions
0da2362
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden completed Mar 13, 2026 in 1m 32s

1 issue

Low

Missing test coverage for GeneratorExit scenario - `sentry_sdk/integrations/anthropic.py:374-421`

The PR adds a try/finally block to ensure spans are closed when generators are not fully consumed (e.g., via GeneratorExit). However, the existing test file doesn't include tests that verify this behavior - all streaming tests iterate the entire stream with for _ in message: pass. Without tests covering early termination, the fix may regress undetected.

4 skills analyzed
Skill Findings Duration Cost
code-review 1 48.4s $0.36
find-bugs 0 1m 30s $0.55
skill-scanner 0 6.2s $0.04
security-review 0 19.4s $0.13

Duration: 2m 44s · Tokens: 792.5k in / 5.7k out · Cost: $1.09