Reputation: 8665
With the following piece of code (taken from an @Effect() in ngrx/store)
.switchMap(({token, param1, param2}) => {
return Observable.combineLatest(
this.service.getData2(token, param1),
this.service.getData2(token, param2),
this.service.getData3(token),
);
})
What would be the most succinct yet correct pattern to catch the errors?
Should the .catch follow every getData*
call? We don't want .catch()
at the end of the main @Effect()
chain, do we?
The question is similar to this one, yet a bit different in that I don't a .subscribe()
call here.
Upvotes: 2
Views: 3456
Reputation: 19288
This totally depends on the desired behaviour. Lets asume you are fetching 3 animals which you will display. What do you want to happen when one fail?
catch
to the endcatch
to each data call.Upvotes: 4