-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Description
There have been many requests for a behavior where when an iterator calls back with an error, the error is collected, and execution continues. There have been a couple attempts at this feature, but the implementations fall short.
In theory, this would be applied to just about any async function, map
, series
, parallel
, forEachSeries
, etc.. I'd like to support this broadly, but without having to create duplicate implementations for each function. Something we can wrap existing functions with, without having to modify the implementations.
We also need to settle on what the name is for this type of behavior. These have been proposed:
mapCollect
/parallelCollect
/eachSeriesCollect
mapContinue
/parallelContinue
/eachSeriesContinue
mapAnyway
/parallelAnyway
/eachSeriesAnyway
mapMaybe
/parallelMaybe
/eachSeriesMaybe
mapResume
/parallelResume
/eachSeriesResume
Lastly -- how should the collected results be passed to the final callback?
callback(null, {errors: [], results: []])
callback(null, [Error, results, results, Error, results..])
callback(null, [{err: null, result: results0}, {err: Error, result: null}, ...])
callback(null, results, errors)