Skip to content

Commit

Permalink
Better handling of server error pages
Browse files Browse the repository at this point in the history
  • Loading branch information
McKael committed May 1, 2017
1 parent 2fa929c commit e9d72f1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ func restAPI(request rest.Request) (*rest.Response, error) {
if err != nil {
return nil, err
}
if res.StatusCode < 200 || res.StatusCode >= 300 {
return nil, errors.Errorf("bad server status code (%d): %s",
res.StatusCode, http.StatusText(res.StatusCode))
}

// Build Response object.
response, err := rest.BuildResponse(res)
Expand Down

0 comments on commit e9d72f1

Please sign in to comment.