apollo-client: Possible Unhandled Promise Rejection

Apollo 1.0.0-rc.4. React Native 0.42.3

I have some query:

client.query({
  query: SOME_QUERY,
  options: {
    fetchPolicy: 'network-only',
  },
  variables: { ... },
}).then(result => {
  
}).catch(error => {
  console.log(error)
});

And when I turn off my internet connection I am getting this error message: Possible Unhandled Promise Rejection (id: 0):Network error: Network request failed

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (8 by maintainers)

Commits related to this issue

Most upvoted comments

@helfer please reopen this issue. I am getting this error again but now with refetch function. My code

const withData = graphql(PROFILE_QUERY, {
  options: ({ currentUserId }) => ({
    variables: { id: currentUserId }
  }),
  props: ({ ownProps, data: { loading, user, error, refetch } }) => ({
    loading,
    user,
    error,
    refetch
  })
});

const withHomeHandlers = withHandlers({
  refetchUser: props => async() => {
    const { setRefresh, refetch } = props;
    setRefresh(true);
    await refetch();
    setRefresh(false);
  }
});

I see my profile, switch off my internet connection and make refetch then I am see Network Error at props.error. This is fine I can handle errors but I think query is still running and after query timeout I got the same error as above.

For everyone seeing this in refetch, see #3631

If it doesn’t work, a reproduction with https://github.com/apollographql/react-apollo-error-template would be much appreciated.