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 thenext
andcomplete
but never theerror
handler of the Observable subscription being called (and likewise, never thecatchError
operator in an Observablepipe
). So that leads me to conclude that thenext
handler in the subscription would need to include any error-handling logic after explicitly testing for length in theerrors
array property of itsFetchResult
parameter. Alternatively, I suppose one could perform thaterrors
array test in amap
or other RxJS operator in apipe
from the Observable subscription, and then decide whether to return partial data or the error using the RxJSthrowError
operator.