Swallows GraphQL errors
If your GraphQL endpoint returns an error, this module will swallow it here: https://github.com/kevva/graphql-got/blob/v0.1.1/index.js#L38
Instead of dropping res.body.errors, they should be assigned to res (maybe as res.errors?). Would you accept a PR that introduces this change?
@stephenmathieson, sure!
What do you think about rejecting if errors are present? It can be pretty easy for a user to miss them, especially if they aren't too well-versed with GraphQL.
I agree. It should reject on errors.
@kevva Thoughts?
Interesting thought. I'm pretty used to doing something like this (coming from apollo-client):
if (data.error) {
handleErrorSomehow(data.error)
}
Where data.error is the error coming back from the GraphQL server. The errors raised (thrown) by apollo-client are network errors instead. See the docs for more.
Not suggesting we should mirror the behavior from apollo-client, but it is why I figured keeping it on the returned res object was the right move.