Demo:  catchError

catchError operator can catch the occurance of an error and convert it into any desired observable to avoid abrupt ending of our programs.

//When (v == 3), add the given error to output stream
let input = timer(500,1000).pipe(concatMap(v =>
        (v==3)? throwError(()=>new Error("E")):of(v)
        ));

//catch any error and convert to the given observable
let process = catchError(err => of('e'));

let output = input.pipe(process).subscribe(v=>console.log(v))