Skip to content
This repository has been archived by the owner on Mar 12, 2021. It is now read-only.

Commit

Permalink
Fix in error messages when not returned as json
Browse files Browse the repository at this point in the history
  • Loading branch information
bgokden committed Feb 12, 2019
1 parent 40b6848 commit 5c14611
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ Return the error object with message to be returned
It can be used after checking with IsError
*/
func getError(resp *resty.Response) error {
return errors.New(resp.Error().(*ErrorResponse).Message)
message := resp.Error().(*ErrorResponse).Message
if message == "" {
message = string(resp.Body())
}
return errors.New(message)
}

/*
Expand Down

0 comments on commit 5c14611

Please sign in to comment.