1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Prevent panic upon error pulling registry

This commit is contained in:
Guillaume J. Charmes 2013-09-16 16:18:25 -07:00
parent 986906cd7b
commit e836b0064b
No known key found for this signature in database
GPG key ID: B33E4642CB6E3FF3

View file

@ -161,10 +161,10 @@ func (r *Registry) GetRemoteHistory(imgID, registry string, token []string) ([]s
req.Header.Set("Authorization", "Token "+strings.Join(token, ", "))
res, err := doWithCookies(r.client, req)
if err != nil || res.StatusCode != 200 {
if res != nil {
if res.StatusCode == 401 {
return nil, ErrLoginRequired
}
if res != nil {
return nil, utils.NewHTTPRequestError(fmt.Sprintf("Internal server error: %d trying to fetch remote history for %s", res.StatusCode, imgID), res)
}
return nil, err