Skip to content

Commit

Permalink
ensure a proper error is returned
Browse files Browse the repository at this point in the history
  • Loading branch information
theganyo committed May 11, 2020
1 parent 76c2697 commit d98bbfc
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions apigee/edge_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,10 +413,6 @@ func (c *EdgeClient) Do(req *http.Request, v interface{}) (*Response, error) {
}

func (r *ErrorResponse) Error() string {
// if r.RequestID != "" {
// return fmt.Sprintf("%v %v: %d (request %q) %v",
// r.Response.Request.Method, r.Response.Request.URL, r.Response.StatusCode, r.RequestID, r.Message)
// }
return fmt.Sprintf("%v %v: %d %v",
r.Response.Request.Method, r.Response.Request.URL, r.Response.StatusCode, r.Message)
}
Expand All @@ -436,7 +432,9 @@ func CheckResponse(r *http.Response) error {
if err == nil && len(data) > 0 {
err := json.Unmarshal(data, errorResponse)
if err != nil {
return err
errorResponse.Message = ResponseErrorMessage{
Message: string(data),
}
}
}

Expand Down

0 comments on commit d98bbfc

Please sign in to comment.