variable / @typed/router/Matcher

catch

Handles the first typed failure from an Fx or Matcher.

Package version
1.0.0-beta.13
Category
Route recovery
Since
1.0.0

Import

import { catch } from "@typed/router/Matcher";

This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.

Signatures

export { catch_ as catch };
export declare const catch_: {
    <I extends Fx.Fx.Any | Matcher.Any, B, E2, R2>(f: (e: InputError<I>) => Fx.Fx<B, E2, R2>): (input: I) => Fx.Fx<InputSucces<I> | B, E2, InputServices<I> | R2 | Router | Scope.Scope>;
    <I extends Fx.Fx.Any | Matcher.Any, B, E2, R2>(input: I, f: (e: InputError<I>) => Fx.Fx<B, E2, R2>): Fx.Fx<InputSucces<I> | B, E2, InputServices<I> | R2 | Router | Scope.Scope>;
};

Why

Convenient recovery does not swallow defect or interruption causes.

Ownership and lifetime

Calling the combinator constructs an Fx. Typed recovery runs inside the consumer Scope; defects and interruption are re-emitted without a replacement lifetime.

Call signatures

Creates a data-first or data-last typed-failure recovery Fx.

Call signatures: Why

The first typed failure is recoverable without converting defects or interruption into ordinary application errors.

Call signatures: Ownership and lifetime

Calling this signature only constructs an Fx. Recovery runs in the consumer Scope; unmatched complete causes are forwarded without starting a fallback subscription.

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source