# catchCause

Recovers from errors in the `EventHandler`.

## Signatures

```ts
export declare const catchCause: {
    <E, E2 = never, R2 = never>(f: (cause: Cause.Cause<E>) => Effect.Effect<unknown, E2, R2>): <Ev extends Event, R = never>(handler: EventHandler<Ev, E, R>) => EventHandler<Ev, E2, R | R2>;
    <Ev extends Event, E = never, R = never, E2 = never, R2 = never>(handler: EventHandler<Ev, E, R>, f: (cause: Cause.Cause<E>) => Effect.Effect<unknown, E2, R2>): EventHandler<Ev, E2, R | R2>;
};
```

## Why

Handling the full `Cause` preserves interruption and defect information
instead of reducing failures to thrown exceptions.

## Ownership and lifetime

The returned description installs no listener. Recovery runs in the same
handler fiber and mount Scope when a real event arrives.

## Examples

```ts
import { Effect } from "effect"
import * as EventHandler from "@typed/template/EventHandler"

const handler = EventHandler.make((event) =>
  Effect.fail("Something went wrong")
)

// Recover from errors
const recovered = EventHandler.catchCause(handler, (cause) =>
  Effect.sync(() => console.error("Error:", cause))
)
```
