@servicenow/sdk - v4.13.3
    Preparing search index...

    Type Alias TryCatchCatchFunction<Try, R>

    TryCatchCatchFunction: (tryOutputs: ArmOutputs<Try>) => R

    Function type for the body of the catch block.

    The catch arm optionally receives the try arm's outputs as its single parameter. This is how a catch arm references an action that ran in the try arm (e.g. inspecting __action_status__ of a try-arm action to decide how to handle the failure):

    catch: (tryOutputs) => {
    // tryOutputs.lookup is the try arm's `lookup` action output
    if (tryOutputs.lookup.__action_status__.code === 1) { ... }
    }

    Passing the try outputs as a parameter (rather than referencing the outer TryCatch binding) is deliberate: the two arms are separate scopes, and a self-reference to the outer binding from inside the catch arm would be a temporal-dead-zone / unbuildable cycle.

    The parameter is declared required (not optional) so that a catch arm which uses it can dot-walk without a "possibly undefined" error under strict mode. Back-compat is preserved regardless: TypeScript allows a zero-argument function (catch: () => { ... }) to satisfy a one-parameter function type, so existing side-effect-only catch arms keep compiling unchanged.

    Type Parameters

    Type Declaration