Suppress Error
This library wraps a function, suppresses node-style errors, and surfaces them
in the value. This is useful when you're working with async
and need the
entire map
(or all tasks in parallel
) not to fail because of
failure in one.
Usage
var suppressError = ; { ;} var suppressedAction = ; ; ;
async
With var async = suppressError = assert = ; async;
Note that even though one
returned an error, the final
callback was called (as async intentionally never got the error),
and the error itself is surfaced in one.error
.
API
suppressError(Function) -> Function
The called wrapped function returns a error
(which is null) as
the first argument and results
as the second argument, which contains:
{
error: (Error|null), // that was passed to the cb
value: Object, // the first non-error argument (for convenience)
values: Array // all of the non-error arguments
}