INNER CODE UNIT · Python
_call_event_handlers
rio-labs/rio · rio/app.py:376
async def _call_event_handlers(
self,
handlers: t.Iterable[t.Callable[[T], t.Any | t.Awaitable[t.Any]]],
event_data: T,
) -> None:
"""
Calls all event handlers in the given list, guarding against exceptions.
"""
for handler in handlers:
# If the handler is available, call it and await it if necessary
try:
result = handler(event_data)
if inspect.isawaitable(result):
await result
# Display and discard exceptions