Documents for @litert/utils-flow-control
    Preparing search index...

    Interface ITryCatchOptions<TOk, TErr, TFinal>

    The options for the try-catch[-finally] expression.

    interface ITryCatchOptions<TOk, TErr, TFinal extends void | Promise<void>> {
        catch: (e: unknown) => TErr;
        finally?: () => TFinal;
        try: () => TOk;
    }

    Type Parameters

    • TOk
    • TErr
    • TFinal extends void | Promise<void>
    Index

    Properties

    Properties

    catch: (e: unknown) => TErr

    The body of the catch statement.

    Even if the catch is triggered, and even if an exception is thrown in the catch, the finally will still be executed.

    It can be an asynchronous function or a synchronous function.

    finally?: () => TFinal

    The body of the finally statement.

    To avoid difficult-to-handle situations, ensure that the finally statement does not throw an exception. (But if the finally statement throws an exception, it can still be caught by the outer try-catch.)

    Even if the catch is triggered, and even if an exception is thrown in the catch, the finally will still be executed.

    It must be a synchronous function.

    try: () => TOk

    The body of the try statement.

    It can be an asynchronous function or a synchronous function.