Skip to content

fix: prevent SystemExit(0) from being reported as Sentry error - #759

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/sentry-systemexit-0
Open

fix: prevent SystemExit(0) from being reported as Sentry error#759
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/sentry-systemexit-0

Conversation

@sentry

@sentry sentry Bot commented Aug 10, 2026

Copy link
Copy Markdown

This PR addresses an issue where normal program termination (indicated by SystemExit: 0) was being captured and reported as an error by Sentry.

The root cause was that the _before_send function in codecov_cli/opentelemetry.py, responsible for filtering Sentry events, did not explicitly handle SystemExit with a code of 0 or None. Consequently, the Sentry SDK would capture these normal exits as unhandled exceptions.

The fix modifies the _before_send function to check for SystemExit exceptions. If the exception type is SystemExit and its code is 0 or None (which signifies a clean exit), the event is now suppressed by returning None. This ensures that Sentry only receives reports for actual errors, reducing noise and improving the signal-to-noise ratio in error monitoring.

Fixes CLI-G7

@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
723 1 722 1
View the full list of 1 ❄️ flaky test(s)
api.temp.calculator.test_calculator::test_divide

Flake rate in main: 100.00% (Passed 0 times, Failed 1625 times)

Stack Traces | 0.001s run time
def
                test_divide():
                > assert Calculator.divide(1, 2) == 0.5
                E assert 1.0 == 0.5
                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)
                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide
                .../temp/calculator/test_calculator.py:30: AssertionError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants