This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
ApolloLink emits both value and error in catch #542
Labels
blocking
Prevents production or dev due to perf, bug, build error, etc..
good first issue
Issues that are suitable for first-time contributors.
has-reproduction
❤ Has a reproduction in a codesandbox or single minimal repository
Expected Behavior
Observable.catch should emit either recovered value or error.
Actual Behavior
The error is emitted and bubbled up the Rx Observable chain just fine. When caught by the subscriber error action, the observable will be closed and the value emition is never handled causing the app to crash.
A simple reproduction
Place any query and ensure a response with HTTP status code set to anything above 300.
Make sure the errors is set and not null.
See demo project here
Issue Labels
Some details:
I believe the issue is in:
apollo-link/packages/apollo-link-http/src/httpLink.ts
Line 130 in c9843e5
The above
observer.next()
ends-up in Promise.reject() in ApolloClient QueryManager.fetchRequest(). The rejection of the Promise will cause the involving Observable stream to be completed.The above code when modified to the sample below fixes the experienced issues:
Edit by @evans: Attempt to get Apollo Bot to run
The text was updated successfully, but these errors were encountered: