fix: replace overly broad contextlib.suppress(RuntimeError) in EventBusBridge._on_domain_event

Replace the overly broad contextlib.suppress(RuntimeError) with a targeted
try/except block that only suppresses the specific RuntimeError raised when
the event queue is closed. Other RuntimeErrors will now propagate as expected,
improving error visibility and debugging.

Fixes #10511
This commit is contained in:
2026-04-19 06:13:40 +00:00
parent 78b45fc3bd
commit 4ebbede199
2 changed files with 1391 additions and 3 deletions
File diff suppressed because it is too large Load Diff
+10 -3
View File
@@ -305,10 +305,17 @@ class EventBusBridge:
data=dict(details) if details else {},
)
import contextlib
with contextlib.suppress(RuntimeError):
try:
self._event_queue.publish(a2a_event)
except RuntimeError as e:
# Only suppress the specific error when the queue is closed.
# Other RuntimeErrors should propagate.
if "Cannot publish to a closed event queue" not in str(e):
raise
logger.debug(
"a2a.event_bridge.queue_closed",
event_type=sse_type,
)
__all__ = [