API · Errors

failOnError()

Turn the first recoverable record error reaching this operator into a fatal pipeline failure.

Signature

failOnError(): Exstream<T, C>

Example

await exstream(rows).map(validate).failOnError().pipeTo(destination)

Behavior

Successful values pass through unchanged until the first record error. That error is promoted with its original input, the branch fails, and connected work is cancelled. No later records are processed. Fatal failures already in progress bypass record-level policies as usual.

Place recoverable policies such as errors() or skipErrors() before failOnError() if selected failures should not terminate the graph. Context, ordering, and pressure of successful values are unchanged.

Errors

The original error object remains the failure reason; Exstream marks the failure as fatal rather than wrapping it into a different user-visible error. Terminal consumers such as drain(), toPromise(), and pipeTo() reject.

Forms

stream.failOnError()
exstream.pipeline().failOnError()
exstream.failOnError(stream)

errors(), skipErrors(), stopOnError(), routeErrors()