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:
File diff suppressed because it is too large
Load Diff
@@ -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__ = [
|
||||
|
||||
Reference in New Issue
Block a user