From 28f9e90658775f6ffe44395a3bc68719c1346181 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 24 Sep 2026 13:12:44 +0200 Subject: [PATCH 1/2] fix: Keep event if processor raises --- sentry_sdk/scope.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sentry_sdk/scope.py b/sentry_sdk/scope.py index dab8decb75..0d3a0c6cd3 100644 --- a/sentry_sdk/scope.py +++ b/sentry_sdk/scope.py @@ -1828,7 +1828,7 @@ def run_error_processors(self, event: "Event", hint: "Hint") -> "Optional[Event] ) for error_processor in error_processors: - new_event = None + new_event = event with capture_internal_exceptions(): new_event = error_processor(event, exc_info) if new_event is None: @@ -1858,7 +1858,7 @@ def run_event_processors(self, event: "Event", hint: "Hint") -> "Optional[Event] ) for event_processor in event_processors: - new_event = None + new_event = event with capture_internal_exceptions(): new_event = event_processor(event, hint) if new_event is None: From 0d90cbedffc6714fb47cc450cf806c3a23176a79 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 24 Sep 2026 13:18:50 +0200 Subject: [PATCH 2/2] tests --- tests/test_basics.py | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/tests/test_basics.py b/tests/test_basics.py index 218b703bb8..ec6612dc99 100644 --- a/tests/test_basics.py +++ b/tests/test_basics.py @@ -768,49 +768,6 @@ def foo(event, hint): sentry_sdk.scope.global_event_processors = old_processors -@pytest.mark.tests_internal_exceptions -def test_event_processor_exception_drops_event_and_records_client_report( - sentry_init, capture_events, capture_record_lost_event_calls -): - sentry_init(default_integrations=False) - events = capture_events() - record_lost_event_calls = capture_record_lost_event_calls() - - scope = sentry_sdk.get_isolation_scope() - - @scope.add_event_processor - def bad_processor(event, hint): - raise ValueError("processor error") - - capture_message("should be dropped") - - assert len(events) == 0 - assert ("event_processor", "error", None, 1) in record_lost_event_calls - - -@pytest.mark.tests_internal_exceptions -def test_error_processor_exception_drops_event( - sentry_init, capture_events, capture_record_lost_event_calls -): - sentry_init(default_integrations=False) - events = capture_events() - record_lost_event_calls = capture_record_lost_event_calls() - - scope = sentry_sdk.get_isolation_scope() - - @scope.add_error_processor - def bad_error_processor(event, exc_info): - raise ValueError("error processor error") - - try: - raise ValueError("original error") - except Exception: - capture_exception() - - assert len(events) == 0 - assert ("event_processor", "error", None, 1) in record_lost_event_calls - - @pytest.mark.tests_internal_exceptions def test_before_send_exception_records_callback_error( sentry_init, capture_events, capture_record_lost_event_calls