API · Async
massCatch()
Call `.catch()` on every promise value and emit the resulting promises.
Signature
massCatch<U>(
fn: (error: unknown, context: C) => U,
): Exstream<Promise<ResolvedValue<T> | Awaited<U>>, C> Example
const recovered = exstream(requestPromises)
.massCatch((error) => ({ ok: false, error }))
.resolve(8, true) Parameters
fnPassed to each input promise's
catch(). Its return value recovers that promise; throwing or rejecting leaves it rejected.
Behavior
This operator maps promise objects synchronously and does not await or limit their work. Fulfilled inputs pass through their fulfillment value inside a new promise. Rejected inputs invoke fn. Output promise order follows input order; settlement order does not.
Context is captured for the handler only when it declares a second parameter. Every input must expose a callable .catch().
Errors
Invalid inputs become map() record errors. Rejections are promise-level until a promise-aware operator observes them; massCatch() is not the same as errors(), which handles Exstream error records. Use resolve() after it to await outputs.
Forms
stream.massCatch(onRejected)
exstream.pipeline().massCatch(onRejected)
exstream.massCatch(onRejected, stream)
stream.through(exstream.massCatch(onRejected))