Collects an error and adds more context when an error occurs during an iteration, i.e.
function* gen() {
yield 1;
throw new Error("test error");
}
const stream = new ArrayStream(gen, new Settler()).collect();
// {
// data: [1],
// errors: [
// "Error occurred at item at index 1 in iterator: test error",
// ]
// }
Collects an error and adds more context when an error occurs during an operation, i.e.
const stream = new ArrayStream([1,2,3], new Settler())
.map(x => {
if (x === 3) {
throw new Error("test error");
}
return x;
})
.collect();
// {
// data: [1,2],
// errors: [
// "Error occurred while performing map on 3 at index 2 in iterator: test error"
// ]
// }
Error handler that collects all errors during the pipeline execution. Compiling the data will return the data along with the errors.