I have an array of observables that need to fire off sequentially. Once an error happens, I need the to catch the error, log it, and continue observing.
At the moment, once an error occurs, the observer stops. It's essential that the observer continues and does not restart or complete on error.
import * as Rx from "rxjs";
const source = [
Rx.Observable.from("1").delay(200),
Rx.Observable.from("2").delay(150),
Rx.Observable.throw("error"),
Rx.Observable.from("3").delay(124),
Rx.Observable.from("4").delay(201),
];
let sSource = Rx.Observable.concat(...source);
sSource.subscribe((v) => {console.log(v)}, (e) => {console.log(e)});
Current output:
1
2
error
Expected output:
1
2
error
3
4
The only solution that we could come up with was to pre-loop through the source
observables and add catch handlers to them individually, then once an error occurs, it's handled correctly and the observer can continue without completing the entire concatenated observable.
We feel like there should be a more elegant solution to this. I'll post the solution we have at the moment if need be.