apollo-client: Catch error on watchQuery poll

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

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 22 (5 by maintainers)

Most upvoted 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.

I’m also finding an error with this, @jbaxleyiii mind opening this so it can get some more attention again?

@jbaxleyiii can this be re-opened?

@fischerman sorry I haven’t taken a look yet! I’ll be out of town this week but will add it to my list first of next week!