Skip to content

Commit

Permalink
Improve HTTP error text (#364)
Browse files Browse the repository at this point in the history
Thanks to Craig for the suggestion! Since people may have, before #363,
been parsing the text, I mentioned it as a breaking change, although I
imagine most people are parsing just the code, not the text.

I have:
- [x] Written a clear PR title and description (above)
- [x] Signed the [Khan Academy CLA](https://www.khanacademy.org/r/cla)
- [x] Added tests covering my changes, if applicable
- [x] Included a link to the issue fixed, if applicable
- [x] Included documentation, for new features
- [x] Added an entry to the changelog
  • Loading branch information
benjaminjkraft authored Dec 1, 2024
1 parent 1147aaf commit 5913cd6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Note that genqlient now requires Go 1.22.5 or higher, and is tested through Go 1

- omitempty validation:
- forbid `omitempty: false` (including implicit behaviour) when using pointer on non-null input field
- The error text for HTTP errors has changed slightly. If you were parsing it, switch to [`As`-ing to `graphql.HTTPError`](client_config.md#handling-errors)_.

### New features:

Expand Down
2 changes: 1 addition & 1 deletion graphql/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ type HTTPError struct {

// Error implements the error interface for HTTPError.
func (e *HTTPError) Error() string {
return fmt.Sprintf("returned error %v: %s", e.StatusCode, e.Body)
return fmt.Sprintf("returned error %v: '%s'", e.StatusCode, e.Body)
}

0 comments on commit 5913cd6

Please sign in to comment.