-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rejected watchQuery promise is uncatchable #891
Comments
thanks for reporting this. It's due to two different code paths (watchQuery and refetch) being slightly different. I think we could just suppress the warning by catching the error. Do you have time to try it in your app and make a quick PR? It would be as simple as adding a catch here. |
Fixes apollographql#891 The error wasn't caught anywhere. Should anything be done with the error? For subscriptions it is handled via the store I believe.
@helfer, I created a PR for this. Could you have a look? Edit: I don't think there is a way to actually test this. Maybe it's possible to see if the console shows the error or not... |
Intended outcome:
I was trying to use
watchQuery
and used anerror
handler when subscribing to updates on the returned observer:I expected this to handle the error without any issues.
Actual outcome:
When the underlying query fails it correctly calls the error handler but also prints this in my console:
Reproduction:
Subscribe on an observer that was returned by
.watchQuery
and make it fail (by throwing an error in your resolver on the server for example).Extra information
There is no way to catch the error because
watchQuery
handles the query internally and doesn't return the promise anywhere.The promise seems to be rejected here: https://github.com/apollostack/apollo-client/blob/master/src/core/QueryManager.ts#L959-L973
The text was updated successfully, but these errors were encountered: