Skip to content
Français

WorkflowFailure

import { WorkflowFailure } from "@elie-laloum/outpost/workflows";

Error thrown by WorkflowResult.unwrap() when status is not done. result holds the whole WorkflowResult, code is its terminationCode and cause is its first error. A rejected gate therefore exposes code rejected; a suspended run has no code.

Complete example and detailed rules.

  • codeRequired
    TerminationCode | undefined
    The result’s terminationCode, available when unwrap() throws for failed, cancelled or rejected runs; undefined for paused or waiting-input runs.
  • resultRequired
    WorkflowResult
    The unsuccessful WorkflowResult, with its task records, errors and usage.
  • nameRequired
    string
    Error class name used to distinguish this failure from other JavaScript errors.
  • messageRequired
    string
    Human-readable explanation of the failure.
  • stackOptional
    string | undefined
    JavaScript stack trace for the error, when available.
  • causeOptional
    unknown
    Underlying failure this error wraps; quotaFault() and unavailableFault() follow this chain.
export declare class WorkflowFailure extends Error {
  readonly code: WorkflowTerminationCode | undefined;
  readonly result: WorkflowResult;
  constructor(result: WorkflowResult);
}