I am facing a challenge with an array of observables that need to fire off sequentially. My goal is for the observer to catch any errors, log them, and continue observing without restarting or completing.
Currently, when an error occurs, the observer stops instead of continuing as desired.
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
We have tried adding individual catch handlers to each observable in the source
array but feel there should be a more elegant solution to this problem. If necessary, I can share our current solution.