I'm facing with a very strange behavior on my project, I have a simple Angular service with the below code:
seatClick$ = new Subject<Seat>();
and a method on the service that fires the observable:
handleSeatClick(seat: Seat) {
this.seatClick$.next(seat);
}
the observable logic is simple:
this.seatClick$.pipe(
exhaustMap((seat: Seat) => {
this.someFunctionThatThrowsException(); // this function throws ref exception
return of(null);
})
, catchError(err => {
console.log('error handled');
return of(null);
})
)
.subscribe(() => {
console.log('ok');
},
(error1 => {
console.log('oops');
})
);
This is really strange, when "someFunctionThatThrowsException" is called it throws some ReferenceError exception, this exception is then catched with the catchError and the next() event is fired.
However, from this moment on the seatClick observable stops responding, as if it was completed, calling handleSeatClick on the service won't respond any more.
What am I missing here?
this.someFunctionThatThrowsException()
? – Billman