• Executes a callback in a safe throwable environment, by catching errors and returning them in a [Either<L, R>] value.

    Type Parameters

    Parameters

    • call: (() => Either<L, R>)

      the callback to execute

    • Optional onError: ((error) => L)

      a callback to transform an internal [Error] in a [TypedError]

        • (error): L
        • Parameters

          • error: Error

          Returns L

    Returns Either<L, R> | {
        left: {
            cause: string;
            stack: undefined | string;
            type: "unknown-error";
        } | L;
        tag: "left";
    }

Generated using TypeDoc