> ## Documentation Index
> Fetch the complete documentation index at: https://abxbus.archivebox.io/llms.txt
> Use this file to discover all available pages before exploring further.

# AutoErrorEventMiddleware

> Emit auto error events when handlers fail.

`AutoErrorEventMiddleware` emits `{OriginalEventType}ErrorEvent` when a handler completes with an error.

## Constructor params

None.

## Setup with EventBus

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    from abxbus import EventBus
    from abxbus.middlewares import AutoErrorEventMiddleware

    bus = EventBus(
        name='AppBus',
        middlewares=[AutoErrorEventMiddleware()],
    )
    ```
  </Tab>

  <Tab title="Rust">
    ```rust theme={null}
    // Not implemented in the Rust crate yet.
    // Use explicit typed handler wrappers around bus.on(...) for this behavior for now.
    ```
  </Tab>
</Tabs>

## Behavior

* Runs on completed handler results.
* If a handler errored, emits an auto event with:
  * `event_type`: `{OriginalEventType}ErrorEvent`
  * `error`: original exception
  * `error_type`: exception class name
* Skips source events ending in `ErrorEvent` or `ResultEvent` to prevent auto recursion.
