Re-implemented graphqlerrors
package to be more idiomatic Go code.
#1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @chris-ramon
Really appreciate the work you've put into so far in making a golang graphql library thats closely based on
graphql-js
JS library released recently. (There are other golang-based graphql libraries but most of them were pre-graphql-js
). Would love to see where this go.I would like to make a suggestion for this library to be more Go-idiomatic, specifically with error-handling.
It'll make it easier to use it with other Go packages.
Comments appreciated.
Details
Generally, most package users would expect a consistent error handling.
This might seem trivial, but has an intangible benefit of not introducing more friction for other devs to adopt the packages.
Reference: https://github.com/golang/go/wiki/Errors
graphql-js
LocatedError
,SynxtaxError
)Tested
Does not break existing tests.
$ go build $ go test github.com/chris-ramon/graphql-go/language/parser github.com/chris-ramon/graphql-go/language/lexer ok github.com/chris-ramon/graphql-go/language/parser 0.005s ok github.com/chris-ramon/graphql-go/language/lexer 0.008s