Vue-apollo: Catch Graphql Error

Created on 11 Aug 2018  Â·  6Comments  Â·  Source: vuejs/vue-apollo

Have to show the graphql error returned from the server to the user...

image

the message also showing GraphQL Error:. How to remove that?

Most helpful comment

No need to be condescending, I'm just asking how did you resolve your problem in case of someone is having the same issue and seeking for a solution :slightly_smiling_face:

All 6 comments

How do you catch the error?

finally got what I want.

How did you do?

Try digging into the error a bit further @Kocal – there's more data that comes along with the object, and some of that data is a better error message. Here's my solution:

error.graphQLErrors.forEach(err => console.log(err.message))

@Kocal use object destructuring method.....
const { graphQLErrors, networkError } = err;

No need to be condescending, I'm just asking how did you resolve your problem in case of someone is having the same issue and seeking for a solution :slightly_smiling_face:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dsbert picture dsbert  Â·  4Comments

seanaye picture seanaye  Â·  3Comments

chadwtaylor picture chadwtaylor  Â·  3Comments

wangxiangyao picture wangxiangyao  Â·  4Comments

agosto-chrisbartling picture agosto-chrisbartling  Â·  4Comments