If you have a config like this:
apollo: {
something() {
return {
query: MyQuery,
fetchPolicy: 'network-only',
variables: {
id: this.id,
},
update({ something }) {
return convert(something);
},
error({ graphQLErrors }) {
console.log('error handler');
},
};
},
}
and you have graphQLErrors, then update is still called. This is unexpected, and in fact it worked as expected (update is not called) until v3.0.0-beta.10. Then in https://github.com/Akryum/vue-apollo/commit/878f966b1f3e8e150097667c02f6d7973c4419de, something was changed to hide the GraphQL console error if the error() handler exists.
However, I would expect that vue-apollo respects the errorPolicy of apollo in this case, i.e. by default it's none and a graphQLError means any data is ignored. See https://www.apollographql.com/docs/react/api/react-apollo.html#graphql-config-options-errorPolicy (the docs are for react, but the code is in apollo-client. In fact, since react handles errorPolicy, I think vue-apollo should too.
Looks like a good idea since we don't have any code in vue-apollo compatibled with errorPolicy now. Maybe we can also have an errorPolicy prop in ApolloQuery component.
I think I have the same problem as this issue describes.
I have an ApolloClient like this:
ApolloClient({
...
defaultOptions: {
query: {
errorPolicy: 'all'
}
}
})
then I have a graphql server that on some fields have special permissions (using graphql directives). So it returns AuthenticationError when some of these fields are in the query. It returns errors in errors, but the data in those fields are null. The other fields are however populated, so I still want the data.
.result(queryresult) is called, but queryresult.data is empty..
vue-apollo now fully supports errorPolicy. I added a test case:

Was about time :sweat_smile:
Given how this is an important part of error handling in apollo client, perhaps an update to the docs of https://apollo.vuejs.org/ would be helpful? Not everyone is moving to the v4 vue apollo docs at the current slowish pace everyone is updating their libraries to support vue 3...
https://www.apollographql.com/docs/react/data/error-handling/