Skip to main content

@flow-state-dev/core/errors/suspension-error

Classes​

SuspensionError​

Extends​

  • Error

Constructors​

Constructor​
new SuspensionError(options): SuspensionError;
Parameters​
options​

SuspendOptions & object

Returns​

SuspensionError

Overrides​

Error.constructor

Properties​

allow​
readonly allow: ResumeAction[];

Permitted resolution actions, defaulted by reason (see resolveAllowedActions).

cause?​
cause?: unknown;
Inherited from​

Error.cause

data?​
readonly data?: Record<string, unknown>;
kind?​
readonly kind?: SuspendForUserKind;

What a user's suspension asks for, when the caller set it (see SuspendOptions.kind).

message​
message: string;
Inherited from​

Error.message

name​
name: string;
Inherited from​

Error.name

reason​
readonly reason: SuspensionReason;
render?​
readonly render?: object;
component​
component: string;
props?​
props?: Record<string, unknown>;
resumeSchema?​
readonly resumeSchema?: Record<string, unknown>;
stack?​
stack?: string;
Inherited from​

Error.stack

suspensionId​
readonly suspensionId: string;
timeoutMs?​
readonly timeoutMs?: number;
title?​
readonly title?: string;

The suspension's short heading, when the caller gave one (see SuspendOptions.title).


SuspensionRejectedError​

Extends​

  • Error

Constructors​

Constructor​
new SuspensionRejectedError(
suspensionId,
rejectedBy?,
rejectionData?,
options?
): SuspensionRejectedError;
Parameters​
suspensionId​

string

rejectedBy?​

string

rejectionData?​

unknown

options?​
cancelled?​

boolean

expired?​

boolean

Returns​

SuspensionRejectedError

Overrides​

Error.constructor

Properties​

cancelled​
readonly cancelled: boolean;

True when nobody answered: the task the suspension's request works was cancelled while it waited, or the board cancelled this stop. ctx.suspendForUser returns { cancelled: true } for it instead.

cause?​
cause?: unknown;
Inherited from​

Error.cause

expired​
readonly expired: boolean;

True when nobody rejected the suspension: it passed its expiresAt unanswered, and the run continues as if it were no longer valid.

message​
message: string;
Inherited from​

Error.message

name​
name: string;
Inherited from​

Error.name

rejectedBy?​
readonly rejectedBy?: string;
rejectionData?​
readonly rejectionData?: unknown;
stack?​
stack?: string;
Inherited from​

Error.stack

suspensionId​
readonly suspensionId: string;

SuspensionTimeoutError​

Thrown where a suspension that is not an approval resumes at its deadline with no answer: a review's or an input's ctx.suspendForUser, or a raw ctx.suspend that allows no reject. Catch it to go ahead, end, or ask again; left uncaught it fails the try. An approval at its deadline reads as a no instead.

Extends​

  • Error

Constructors​

Constructor​
new SuspensionTimeoutError(suspensionId): SuspensionTimeoutError;
Parameters​
suspensionId​

string

Returns​

SuspensionTimeoutError

Overrides​

Error.constructor

Properties​

cause?​
cause?: unknown;
Inherited from​

Error.cause

message​
message: string;
Inherited from​

Error.message

name​
name: string;
Inherited from​

Error.name

stack?​
stack?: string;
Inherited from​

Error.stack

suspensionId​
readonly suspensionId: string;

Interfaces​

SuspendOptions​

Properties​

allow?​
allow?: ResumeAction[];

Which resolution actions this suspension permits. Omit to take the default for the reason: user_input → ["submit"]; everything else (including user_approval) → ["approve", "reject"]. Add "skip" to make the step optional — a skipped resume returns the SUSPENSION_SKIPPED sentinel from ctx.suspend() instead of aborting. The resume route enforces this set.

data?​
data?: Record<string, unknown>;
kind?​
kind?: SuspendForUserKind;

What a user's suspension asks for. ctx.suspendForUser sets it, with the reason it maps to; a raw ctx.suspend leaves it out, and its kind is then read from its reason (suspendForUserKindOf).

message?​
message?: string;

What the suspension says. With a title, the body under it, and may be markdown.

reason​
reason: SuspensionReason;
render?​
render?: object;
component​
component: string;
props?​
props?: Record<string, unknown>;
resumeSchema?​
resumeSchema?: ZodTypeAny | Record<string, unknown>;

Shape of the payload the resolver supplies on resume. Pass a Zod schema (the framework's schema language) or a pre-built JSON Schema object; either is normalized to a plain, serializable JSON Schema for storage and DevTool rendering. A raw Zod instance must never reach the stores — it carries functions that fail structured-clone and JSON serialization.

suspensionId?​
suspensionId?: string;

The suspension's id, when the caller must record it before the turn parks (a wait gate's row carries it). Must be unique within the request and the same on every replay of the call that suspends. Omit to have one minted.

timeoutMs?​
timeoutMs?: number;
title?​
title?: string;

A short heading for the suspension, a few words. Surfaces that list or head a suspension draw this, and message becomes the body under it. Omit it when message is already one short line.