Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update client to pass response along rather than pulling out errors #20

Open
erutherford opened this issue Sep 4, 2018 · 2 comments
Open

Comments

@erutherford
Copy link
Contributor

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.

@matryer
Copy link
Contributor

matryer commented Oct 15, 2018

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
  }
}

@fubarhouse
Copy link

What's the status of this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants