question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Catch error on watchQuery poll

See original GitHub issue

I 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:

error

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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:22 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
danilobuergercommented, Feb 12, 2019

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.

2reactions
quangman96commented, May 19, 2021

1-1504600589828

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found