Setu-TS
    Preparing search index...

    Function withDeadline

    • Runs one backend call under a deadline whose expiry is a rejection.

      The call receives an AbortSignal. When the deadline fires, the signal is aborted with the caller's error and the returned promise rejects with that same error — even if the call ignores the signal and never settles. The call's own rejection (including a synchronous throw) is propagated unchanged, never masked by the deadline. The timer is cleared on every path.

      An out-of-range timeoutMs REJECTS with RangeError rather than throwing, so a caller chaining .catch() sees it.

      Type Parameters

      • T

      Parameters

      • run: (signal: AbortSignal) => Promise<T>

        The call; receives the signal to forward to its transport

      • options: DeadlineOptions

        The bound, the expiry error and the timer surface

      Returns Promise<T>

      The call's value, or a rejection with the call's error or the deadline's

      (as a rejection) when timeoutMs is out of range

      const response = await withDeadline(
      (signal) => fetch(url, { signal }),
      {
      timeoutMs: 5000,
      onTimeout: () => new Error('the vault did not answer in 5000 ms'),
      timing: resolveProbeTiming(ctx.runtime),
      },
      );

      0.9.0