Skip to content

Commit

Permalink
made zendesk error have better message for empty body
Browse files Browse the repository at this point in the history
  • Loading branch information
tamccall authored and nukosuke committed Mar 13, 2019
1 parent 9764b5b commit 8686d20
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion zendesk/zendesk.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ type Error struct {

// Error the error string for this error
func (e Error) Error() string {
return fmt.Sprintf("%d: %s", e.resp.StatusCode, string(e.body))
msg := string(e.body)
if msg == "" {
msg = http.StatusText(e.Status())
}

return fmt.Sprintf("%d: %s", e.resp.StatusCode, msg)
}

// Body is the Body of the HTTP response
Expand Down

0 comments on commit 8686d20

Please sign in to comment.