Catch error on watchQuery poll
See original GitHub issueI posted this issue on SO, but no response, so I post it here as a potential bug report. https://stackoverflow.com/questions/44898988/apollo-client-how-to-catch-error-with-pollinterval
I have a watchQuery with a pollInterval, like so:
apollo.watchQuery<any>({
query: ...,
pollInterval: 10000
}))/** retry logic omitted **/.subscribe(..., (err) => {console.error(err)})
I want to ignore any network errors for this particular query.
Intended outcome:
Catch all errors during a poll using the Observable error handler. Network related errors should only bubble up where the query is initiated (including later polls).
Actual outcome:
The error handler is called but I get an additional uncaught promise rejection:
How to reproduce the issue:
- Create a watchQuery with a poll interval, set an error handler on the subscribe call
- Simulate network error (e.g. chrome dev bar)
Additional Info
QueryManager.js:235 maps to QueryManager.ts:476
apollo-client@1.7.0
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:22 (5 by maintainers)
Top Results From Across the Web
Queries - Apollo GraphQL Docs
As our query executes and the values of loading , error , and data change, ... Apollo Client supports two strategies for this:...
Read more >Vue/Apollo/Graphql Client Cannot Read 'Watchquery' Error
Vue/Apollo/Graphql Client Cannot Read 'Watchquery' Error ... Polling means repeatedly calling the server to automatically update the query data.
Read more >Apollo GraphQL - watchQuery and networkErrors issue
The query loading status remains "true" even when I get a network error. (Apollo Error. Code 0. Unknown error). After doing some research...
Read more >Handling Errors with Apollo Client (React) - YouTube
In this video I talk about handling errors when running queries and mutations using Apollo Client in a React project.Table of contents:00:00 ...
Read more >Getting started with Apollo + GraphQL in Angular - Briebug Blog
watchQuery is a method on the Apollo service that contains a couple ... You can handle errors natively within Apollo by creating an...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I haven’t checked wether this is still an issue or not. But I am reopening this since stale bot closed it and several people are still having an issue with it.