Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Expose details for returned errors#48

Open
akupila wants to merge 1 commit into
machinebox:master from
akupila:graphql-errors
Open

Expose details for returned errors #48
akupila wants to merge 1 commit into
machinebox:master from
akupila:graphql-errors

Conversation

@akupila

@akupila akupila commented Oct 1, 2019

Copy link
Copy Markdown

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:

jaylane, bcaw, 3timeslazy, secretworry, merrickfox, na-ga, shiwano, pnx472, basgys, pankrator, and HaraldNordgren reacted with thumbs up emoji
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 commented Nov 18, 2019

Copy link
Copy Markdown

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

lucperkins, merrickfox, na-ga, pnx472, mlaflamm, pankrator, and darrensapalo reacted with thumbs up emoji

Copy link
Copy Markdown

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

tosik, pnx472, mlaflamm, piotrmiskiewicz, basgys, pankrator, and darrensapalo reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@tjha-cf tjha-cf tjha-cf approved these changes
Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /