flow/fault

Source: src/flow/fault.ts

Why a flow is refused before its first spawn: a stable code, the file, where in it, and one sentence.

A fault is data, not an exception, so validation hands back every fault at once and a caller formats them as it likes (/flows writes one per line, file at: message). Codes are a closed set: tests assert them, and the table in docs/guide/flows.md explains each one, which npm test holds to this list.

Fault

type

export type Fault = {
	/** Stable, and what a test or a caller matches: the guide's table explains each one. */
	readonly code: FaultCode;
	/** The file the fault is in. */
	readonly file: string;
	/**
	 * Where: the node's address through its enclosing nodes, without
	 * iterations, then the offending key (`deliver/work/code.retry`). `""` for
	 * the file as a whole.
	 */
	readonly at: string;
	/** One sentence saying what is wrong, and what was meant when it can tell. */
	readonly message: string;
};

One reason a flow is refused.

FaultCode

type

export type FaultCode = (typeof FAULT_CODES)[number];

A fault’s code.