API · Lifecycle
fail()
Terminate the connected graph with a fatal error that record-level handlers cannot recover.
Signature
fail(reason: unknown, input?: unknown): void Parameters
reasonError, string, or other failure reason wrapped/annotated as an Exstream error.
inputOptional value associated with the failure as
exstreamInput.
Behavior
Exstream finds the root of this connected chain and propagates one fatal error downstream. The error has exstreamFatal: true, stage fail, and the supplied input. Signals are cancelled, buffers discarded, affected streams enter aborted, and terminal consumers reject.
Fatal failures bypass errors(), skipErrors(), and other record policies. Use write(error) for a recoverable record error and fail() only when continuing the graph is unsafe.