def __init__(
self,
handlers: dict[type[Exception], GeneralExceptionHandler] | None = None,
publish_handlers: dict[type[Exception], PublishingExceptionHandler] | None = None,
) -> None:
self._handlers: CastedHandlers = {
IgnoredException: ignore_handler,
**{
exc_type: apply_types(
cast("Callable[..., Awaitable[None]]", to_async(handler)),
serializer_cls=None,
)
for exc_type, handler in (handlers or {}).items()
},
}
self._publish_handlers: CastedPublishingHandlers = {
IgnoredException: ignore_handler,
**{
exc_type: apply_types(to_async(handler), serializer_cls=None)
for exc_type, handler in (publish_handlers or {}).items()
},
}