Skip to content
Français

OutpostError

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

Error that Outpost throws with a stable code, frozen details and a recovery record. cause holds the failure it reclassified or wrapped. You can throw it yourself with new OutpostError(code, message, details?, cause?).

Complete example and detailed rules.

  • recoveryRequired
    Readonly<Record<string, unknown>>
    Locations of work retained after the failure, such as branch, directory, commits, transcript, logReference or conversation; empty when nothing was retained. A remote synchronization failure puts its transfer directory in details.recovery instead.
  • codeRequired
    FaultCode
    Stable Outpost fault category used for programmatic failure handling.
  • detailsRequired
    Readonly<Record<string, unknown>>
    Frozen diagnostics for the code: status, stdout, stderr and conversation for a failed agent process; status and retryAfterMs (the minimum wait of a task retry) for an HTTP model error; resetAt for a quota, and fallback when every fallback candidate hit one. unavailable marks an outage for unavailableFault(), including a timeout after an agent reported a connection failure.
  • 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 OutpostError extends Error {
  recovery: Readonly<Record<string, unknown>>;
  readonly code: FaultCode;
  readonly details: Readonly<Record<string, unknown>>;
  constructor(
    code: FaultCode,
    message: string,
    details?: Record<string, unknown>,
    cause?: unknown,
  );
}