AniLink - v3.0.0
    Preparing search index...

    Function safeInvoke

    • Invokes a user-supplied lifecycle hook without letting its exceptions escape into the request pipeline. A throwing hook is reported through the structured reportDiagnostic path whether an onHookError observer is configured. The hook error must not crash the request, be counted as an attempt, or distort retry and error classification.

      The observer path also uses reportDiagnostic, so the Error handed to onHookError always carries the structured AniLinkDiagnostic record (with the raw thrown value as its cause when one exists), so an observer never has to handle both a bare user error and a structured record.

      Type Parameters

      • TArgs extends unknown[]

      Parameters

      • hook: ((...args: TArgs) => void) | undefined

        The hook callback, if configured.

      • name: string

        The hook's option name, used in the report.

      • onHookError: OnHookErrorHandler | undefined

        Consumer callback observing hook failures, when configured.

      • diagnostics: DiagnosticsMode

        The resolved diagnostics mode for the request.

      • ...args: TArgs

        Arguments forwarded verbatim to the hook; the tuple type is inferred from the hook's own signature, so a mismatched call site fails compilation instead of needing a cast.

      Returns void