API · Errors

skipErrors()

Drop every recoverable record error, or only errors accepted by a synchronous predicate.

Signature

skipErrors(
  predicate?: ((error: ExstreamError<T>, input: T, context: C) => unknown) | null,
): Exstream<T, C>

Example

const valid = pipeline.skipErrors((error, input) => {
  return error.code === 'INVALID_ROW' && input.optional
})

Parameters

predicate

Type (error, input, context) => unknown | nullDefault null

Without a predicate, every record error is dropped. With one, a truthy result drops that error and a falsy result forwards it unchanged. The second argument is error.exstreamInput; the third is its lazily materialized context.

Behavior

The predicate is synchronous and is never called for successful values. Those values pass through unchanged and in order. A returned promise is truthy and is not awaited, so asynchronous selection must be modeled with another operator.

Callback arity is preserved deliberately: a unary predicate is called with only error; declaring a second parameter adds the failing input; declaring a third adds the lazily materialized context. This allows existing unary handlers to keep their historical argument list.

Dropping is irreversible. Use routeErrors() when rejected records need an audit trail, retry queue, or dead-letter destination.

Errors

If the predicate throws, its failure becomes a new contextual record error for the same input. Fatal graph failures are never suppressed. A structural CSV or single-document JSON error may pass through the predicate, but dropping it does not prevent its format operator from aborting the branch.

Forms

skipErrors() is available on streams and reusable pipelines. The direct standalone form requires the predicate position; pass null to drop every record error:

stream.skipErrors(predicate)
exstream.pipeline().skipErrors(predicate)
exstream.skipErrors(null, stream)
stream.through(exstream.skipErrors(predicate))

errors(), routeErrors(), errors and lifecycle