You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You're right. Very odd that we don't wrap raw errors in ApolloError. Unfortunately changing this now would require a major version since this would be a breaking change. I don't entirely know the historical reason why non-GraphQL errors aren't wrapped in ApolloError instances.
For now, if you'd like to unify the errors, you might consider wrapping it yourself with a custom link so that all errors that come back through your link chain are ApolloError instances:
I don't entirely know the ramifications of this, so I'd encourage you to test this out and make sure it behaves as you'd expect.
Hopefully though this gives you a starting point. Feel free to play around with this to get your desired outcome. If you only want this for subscriptions and you're using split, consider adding this only to the branch that handles subscriptions.
I'll leave this issue open for now as a potential improvement we can make for a future major.
Issue Description
You can connect to any non-existing endpoint to prove this. Code snippet:
Shouldn't it throw an
ApolloError
withnetworkError
field likeclient.query
andclient.mutate
for unity?Link to Reproduction
I already paste the complete code above.
Reproduction Steps
transpile it and run with node. It will print
@apollo/client
version3.10.7
The text was updated successfully, but these errors were encountered: