Restate Typescript SDK
    Preparing search index...
    • Wrap a user-supplied run closure to surface the abort reason (typically a TerminalError(CANCELLED)) on throw paths if the signal aborted during execution. This converts AbortError (and any other abort-caused failure) into the canonical cancellation TerminalError for journal recording.

      Defensive coercion: if signal.reason is itself not a TerminalError (which shouldn't happen in production but might during testing or with non-cancellation race rejections), we wrap it in one. The journal must record a terminal outcome to avoid retries against a cancelled invocation.

      Exposed for testing — the wrapper's behavior is the part that has semantic bite, separate from the ctx.run plumbing.

      Type Parameters

      • T

      Parameters

      Returns () => Promise<T>