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

Expose details for returned errors #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

akupila
Copy link

@akupila akupila commented Oct 1, 2019

Exposes the error as graphql.Error and returns error details in case they are present in the error response.

The user should assert the error type:

err := cli.Run(...)
if errs, ok := err.(graphql.Errors); ok {
  // Range over errs
}

// or with go 1.13
var errs graphql.Errors
if errors.As(err, errs) {
  // Range over errs
}

Included:

  • message: As before
  • locations: Locations in the query that caused errors
  • paths: Response paths that returned errors
  • extensions: Optional extensions set by the server. The spec specified it's a map but nothing more.

The format matches the June 2018 spec for errors: https://graphql.github.io/graphql-spec/June2018/#sec-Errors

This PR is very similar to some previous ones:

Exposes the error as graphql.Error and returns error details (path,
location, extensions) in case they are present in the error response.

The format matches the June 2018 spec for errors:
https://graphql.github.io/graphql-spec/June2018/#sec-Errors
@bcaw
Copy link

bcaw commented Nov 18, 2019

Could we get some love on this to get merged? It would be great to have better visibility into errors using this lib.

@peterhellberg
Copy link

Is there anything blocking this PR from getting merged? (or #24)

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

Successfully merging this pull request may close these issues.

4 participants