variable / @typed/router

catchCause

Handles complete causes from an Fx or Matcher with a reactive Cause RefSubject.

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

Import

import { catchCause } from "@typed/router";

Signatures

export declare const catchCause: {
    <I extends Fx.Fx.Any | Matcher.Any, B, E2 = never, R2 = never>(f: (cause: RefSubject.RefSubject<Cause.Cause<InputError<I> | RouteNotFound | RouteDecodeError | RouteGuardError>>) => 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 = never, R2 = never>(input: I, f: (cause: RefSubject.RefSubject<Cause.Cause<InputError<I> | RouteNotFound | RouteDecodeError | RouteGuardError>>) => Fx.Fx<B, E2, R2>): Fx.Fx<InputSucces<I> | B, E2, InputServices<I> | R2 | Router | Scope.Scope>;
};

Why

Defects and interruption stay distinguishable from typed failures.

Ownership and lifetime

Calling the combinator constructs an Fx. Running it creates a catch manager in the consumer Scope; that Scope owns the cause RefSubject and fallback subscriptions.

Call signatures

Creates a data-first or data-last complete-cause recovery Fx.

Call signatures: Why

Both call forms preserve the input’s success and service types while exposing failure, defect, and interruption through one reactive Cause RefSubject.

Call signatures: Ownership and lifetime

Calling this signature only constructs an Fx. Its consumer Scope owns the catch manager, cause RefSubject, input subscription, and fallback subscription.

Other public imports

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

Source