Open erutherford opened 6 years ago
This seems fair enough.
I think the default behaviour should be to pull out the first error as it does today (it's simpler and what most people need), but I'm not against adding the complete response as an option.
I think the API should be something like this:
err := client.Run(ctx, req, &resp)
if err != nil {
resp, ok := graphql.Response(err)
if ok {
// TODO: use the complete resp here
}
}
What's the status of this one?
With graphQL it's possible the response could be partially successful. With the way the client is currently configured, it's parsing the errors property and returning an error with the first error in the array if it's not empty.
Would you be open to a PR that instead passes the entire response? This would allow the caller to decide how it wants to handle the returned errors. We're also currently losing additional error context if more than one error is present.