effect-io-ai

Package: effect
Module: Layer

Layer.catch

Recovers from all typed errors by switching to another layer.

When to use

Use when every typed Layer construction error should use the same recovery path.

See

Signature

declare const catch: { <E, RIn2, E2, ROut2>(onError: (error: E) => Layer<ROut2, E2, RIn2>): <RIn, ROut>(self: Layer<ROut, E, RIn>) => Layer<ROut & ROut2, E2, RIn2 | RIn>; <RIn, E, ROut, RIn2, E2, ROut2>(self: Layer<ROut, E, RIn>, onError: (error: E) => Layer<ROut2, E2, RIn2>): Layer<ROut & ROut2, E2, RIn | RIn2>; }

Source

Since v4.0.0