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

Add tests for behavior on error #83

Merged
merged 1 commit into from
Sep 10, 2021
Merged

Conversation

benjaminjkraft
Copy link
Collaborator

Summary:

We guarantee that we never return a nil response, so you can safely do

resp, err := myQuery(...)
return resp.Field.SubField, err

And furthermore, if the error was a GraphQL error, resp may even be
nonzero; other, non-failing fields may be set. (This depends on the
server, of course.) But we weren't testing either of those. Now we do.

Test plan:

make check

We guarantee that we never return a nil response, so you can safely do
```
resp, err := myQuery(...)
return resp.Field.SubField, err
```
And furthermore, if the error was a GraphQL error, `resp` may even be
nonzero; other, non-failing fields may be set.  (This depends on the
server, of course.) But we weren't testing either of those.  Now we do.

Test plan: make check

Reviewers: marksandstrom, adam, miguel
Copy link
Member

@jvoll jvoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@benjaminjkraft benjaminjkraft merged commit 9e1c984 into main Sep 10, 2021
@benjaminjkraft benjaminjkraft deleted the benkraft.test-errors branch September 10, 2021 22:45
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.

2 participants