I have a list of items to parse, but the parsing of one of them can fail.
What is the \"Rx-Way\" to catch error but continue executing the sequence
Code Samp
To keep your endlessObservable$
from dying you can put your failingObservable$
in a higher-order mapping operator (e.g. switchMap
, concatMap
, exhaustMap
...) and swallow the error there by terminating the inner stream with an empty()
observable returning no values.
Using RxJS 6:
endlessObservable$
.pipe(
switchMap(() => failingObservable$
.pipe(
catchError((err) => {
console.error(err);
return empty();
})
)
)
);