Skip to content

Event Bus Error

event_bus_error

Base error for event bus publishing and dispatch failures.

Defines EventBusError, raised when event handlers fail or the message bus
cannot deliver an event. Extends RuntimeErrorMixin, making it catchable as
RuntimeError.

EventBusError

Bases: RuntimeErrorMixin, Error[MetadataValueType]

Base error for event bus publishing and dispatch failures.

Indicates that an event handler failed or the message bus cannot
deliver an event. Extends RuntimeErrorMixin, making it
catchable as RuntimeError.

Example
error = EventBusError("Failed to publish event to message bus")
raise error
Source code in src/forging_blocks/application/errors/event_bus_error.py
class EventBusError[MetadataValueType = object](RuntimeErrorMixin, Error[MetadataValueType]):
    """Base error for event bus publishing and dispatch failures.

    Indicates that an event handler failed or the message bus cannot
    deliver an event. Extends ``RuntimeErrorMixin``, making it
    catchable as ``RuntimeError``.

    Example:
        ```python
        error = EventBusError("Failed to publish event to message bus")
        raise error
        ```

    """

    def __init__(self, message: str) -> None:
        super().__init__(ErrorMessage(message))