Print error for failed HTTP auth request.

Signed-off-by: Kenny Leung <kleung@google.com>
This commit is contained in:
Kenny Leung 2015-12-08 14:24:03 -08:00
parent 9bf537dede
commit d38e02c52f
4 changed files with 18 additions and 13 deletions

View file

@ -240,7 +240,8 @@ func (th *tokenHandler) fetchToken(params map[string]string) (token *tokenRespon
defer resp.Body.Close()
if !client.SuccessStatus(resp.StatusCode) {
return nil, fmt.Errorf("token auth attempt for registry: %s request failed with status: %d %s", req.URL, resp.StatusCode, http.StatusText(resp.StatusCode))
err := client.HandleErrorResponse(resp)
return nil, fmt.Errorf("token auth attempt for registry: %s request failed with status: %d %s: %q", req.URL, resp.StatusCode, http.StatusText(resp.StatusCode), err)
}
decoder := json.NewDecoder(resp.Body)