Index of the value that threw an error.
Optional
lastLast successfully retrieved value, if any (undefined
otherwise).
Number of times the error has been repeated (starts with 0).
It helps to detect when an iterator starts throwing the same error in a loop, so a different error-handling strategy can be applied, such as (for example) re-throwing only when the error is repeated.
.catch((e, ctx) => {
if(ctx.repeats) {
throw e; // re-throw when repeated
}
console.log(e?.message || e); // report the error
});
Iteration state, persisted through entire iteration session.
Alternative value emitter, to replace what we failed to retrieve. Without this call, the errored value is skipped from iteration.
Iteration Error Context.
It is passed into every error handler as the second parameter.
See
catchError