In my one of the Angular application, I have two objects of types Observable<Object1[]>
and Observable<Object2[]>
, which call different apis in the resolver
as below:
resolve(): Observable<[Array<Object1>, Array<Object2>]> {
const object1 = this.bookingService.executeService1(); // returns Observable<Object1[]>
const object2 = this.bookingService.executeService2(); // returns Observable<Object2[]>
return Observable.forkJoin(object1, object2); // Need to do error handing here
}
It works fine unless and until the service returns an error. On error, it shows in the console as Uncaught. I have checked the service api through apps like postman, and it does works fine through it.
I tried to catch it as:
return Observable.forkJoin(object1, object2)
.catch(error => {
console.log('error', error);
});
But it doesn't help.
Let me know if there is any way to catch the error in the resolver through Observable.forkJoin()
;