author | Mikael Berthe <mikael@lilotux.net> |
Mon, 01 May 2017 16:35:46 +0200 | |
changeset 169 | d84b2b83813d |
parent 168 | 9ae8ffbea001 |
child 170 | 3152b7094fab |
--- a/api.go Mon May 01 16:35:00 2017 +0200 +++ b/api.go Mon May 01 16:35:46 2017 +0200 @@ -127,6 +127,10 @@ 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)