Skip to content

Commit 8fef7cf

Browse files
authored
Merge 9cf45e0 into 12f2849
2 parents 12f2849 + 9cf45e0 commit 8fef7cf

File tree

2 files changed

+12
-29
lines changed

2 files changed

+12
-29
lines changed

src/sentry/scm/private/ipc.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,6 @@ def run_webhook_handler_control_task(
408408
event_type_hint,
409409
stream=scm_event_stream,
410410
get_current_time=time.time,
411-
report_error=report_error_to_sentry,
412411
record_count=record_count_metric,
413412
record_distribution=record_distribution_metric,
414413
record_timer=record_timer_metric,
@@ -430,7 +429,6 @@ def run_webhook_handler_region_task(
430429
event_type_hint,
431430
stream=scm_event_stream,
432431
get_current_time=time.time,
433-
report_error=report_error_to_sentry,
434432
record_count=record_count_metric,
435433
record_distribution=record_distribution_metric,
436434
record_timer=record_timer_metric,
@@ -467,7 +465,6 @@ def run_listener(
467465
*,
468466
stream: SourceCodeManagerEventStream,
469467
get_current_time: Callable[[], float] = time.monotonic,
470-
report_error: Callable[[Exception], None] = report_error_to_sentry,
471468
record_count: Callable[[str, int, dict[str, str]], None] = record_count_metric,
472469
record_distribution: Callable[
473470
[str, int, dict[str, str], str], None
@@ -479,10 +476,9 @@ def run_listener(
479476

480477
try:
481478
event = deserialize_event(event_data, event_type_hint)
482-
except msgspec.MsgspecError as e:
483-
report_error(e)
479+
except msgspec.MsgspecError:
484480
record_count(f"{METRIC_PREFIX}.failed", 1, {"reason": "parse", "fn": listener})
485-
return None
481+
raise
486482

487483
if isinstance(event, CheckRunEvent):
488484
exec_listener(listener, stream.check_run_listeners, event, record_count)

tests/sentry/scm/unit/private/test_ipc.py

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ def call_me_maybe(e):
110110
"check_run",
111111
stream=scm,
112112
get_current_time=lambda: 0.0,
113-
report_error=lambda e: None,
114113
record_count=lambda a, b, c: None,
115114
record_timer=lambda a, b, c: None,
116115
)
@@ -149,7 +148,6 @@ def comment_handler(e):
149148
"comment",
150149
stream=scm,
151150
get_current_time=lambda: 0.0,
152-
report_error=lambda e: None,
153151
record_count=lambda a, b, c: None,
154152
record_timer=lambda a, b, c: None,
155153
)
@@ -196,7 +194,6 @@ def pr_handler(e):
196194
"pull_request",
197195
stream=scm,
198196
get_current_time=lambda: 0.0,
199-
report_error=lambda e: None,
200197
record_count=lambda a, b, c: None,
201198
record_timer=lambda a, b, c: None,
202199
)
@@ -246,7 +243,6 @@ def record_timer(key, amount, tags):
246243
"check_run",
247244
stream=scm,
248245
get_current_time=lambda: 200.0,
249-
report_error=lambda e: None,
250246
record_count=record_count,
251247
record_distribution=record_distribution,
252248
record_timer=record_timer,
@@ -287,7 +283,6 @@ def record_count(key, amount, tags):
287283
"check_run",
288284
stream=SourceCodeManagerEventStream(),
289285
get_current_time=lambda: 0.0,
290-
report_error=lambda e: None,
291286
record_count=record_count,
292287
record_timer=lambda a, b, c: None,
293288
)
@@ -328,7 +323,6 @@ def record_count(key, amount, tags):
328323
"check_run",
329324
stream=scm,
330325
get_current_time=lambda: 0.0,
331-
report_error=lambda e: None,
332326
record_count=record_count,
333327
record_timer=lambda a, b, c: None,
334328
)
@@ -341,29 +335,22 @@ def record_count(key, amount, tags):
341335

342336

343337
def test_run_listener_malformed_input():
344-
error = None
345338
metrics = []
346339

347-
def report_error(e):
348-
nonlocal error
349-
error = e
350-
351340
def record_count(a, b, c):
352341
metrics.append((a, b, c))
353342

354-
# Implicitly tests no exception was raised.
355-
run_listener(
356-
"t",
357-
"",
358-
"check_run",
359-
stream=SourceCodeManagerEventStream(),
360-
get_current_time=lambda: 0.0,
361-
report_error=report_error,
362-
record_count=record_count,
363-
record_timer=lambda a, b, c: None,
364-
)
343+
with pytest.raises(msgspec.MsgspecError):
344+
run_listener(
345+
"t",
346+
"",
347+
"check_run",
348+
stream=SourceCodeManagerEventStream(),
349+
get_current_time=lambda: 0.0,
350+
record_count=record_count,
351+
record_timer=lambda a, b, c: None,
352+
)
365353

366-
assert isinstance(error, msgspec.MsgspecError)
367354
assert metrics == [("sentry.scm.run_listener.failed", 1, {"reason": "parse", "fn": "t"})]
368355

369356

0 commit comments

Comments
 (0)