graphql-go
graphql-go copied to clipboard
First test for errors, then for content
If there are serious errors the returned Data field might be empty, which is a JSON parse error. So we need to check errors first, then the rest.
This is half of #267, which @pavelnikolov requested me to split up.
Also, you might consider adding some unit tests and asses that you get correct message when you move the error checking first?
I wouldn't mind, but frankly I have no idea how to make unittests for unittests :( I do want to refer to the comments in #267 which show a before/after example i got from using this in my code.