One of my Angular applications has two objects, Observable<Object1[]>
and Observable<Object2[]>
, that call different APIs in the resolver:
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); // Error handling needed
}
Everything runs smoothly until an error occurs. When an error happens, it appears as Uncaught in the console. I've tested the service API using tools like Postman, and it functions correctly there.
I attempted to catch the error like this:
return Observable.forkJoin(object1, object2)
.catch(error => {
console.log('error', error);
});
Unfortunately, this approach did not resolve the issue.
If you have any suggestions on how to properly handle errors in the resolver with Observable.forkJoin()
, please let me know.