Handling errors with ErrorPolicy all in Observable subscriptions?
#1582
-
|
How do the various ApolloClient ErrorPolicy options interact with Apollo Angular's use of RxJS Observable subscriptions? I know that default |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
In testing, I found that setting |
Beta Was this translation helpful? Give feedback.
In testing, I found that setting
errorPolicy: 'all'results in only thenextandcompletebut never theerrorhandler of the Observable subscription being called (and likewise, never thecatchErroroperator in an Observablepipe). So that leads me to conclude that thenexthandler in the subscription would need to include any error-handling logic after explicitly testing for length in theerrorsarray property of itsFetchResultparameter. Alternatively, I suppose one could perform thaterrorsarray test in amapor other RxJS operator in apipefrom the Observable subscription, and then decide whether to return partial data or the error using the RxJSthrowErroroperator.