apollo-client: errorPolicy not working

When setting errorPolicy to all. Neither errors nor data.X is in the response. Setting it to ignore, i get the partial data but no error, using the default configuration i get data.error but not query data.

Intended outcome: errorPolicy should behave as documented: Add a errors field next to data in case of an error

Actual outcome: There is neither errors nor response data

How to reproduce the issue: Create a graphql object like this:

const withDataAndErrors = graphql(QUERY_THAT_HAS_DATA_AND_ERRORS, {
  options: {
    errorPolicy: 'all'
  }
});

that query should return something like:

{
  "data": {...},
  "errors": [...]
}

Version

  • apollo-client@2.1.0

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 10
  • Comments: 19 (6 by maintainers)

Most upvoted comments

This is fixed on master and will be released this week 🌮

sorry about the delay here!

@Matt-Dionis could you test my proposed solution and give some feedback if it is working as it should? Then I’ll make a pull request.

@arvinsim Looks like it is merged now (apollo-client 2.2.5). I upgraded to 2.2.5 yesterday and changed errorPolicy to all and things are now working as expected. 👍