mirror of https://github.com/docker/docs.git
Returning error when Image Pull fails
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
This commit is contained in:
parent
40456d0926
commit
af5ce4bdb0
|
|
@ -991,12 +991,20 @@ func (e *Engine) Pull(image string, authConfig *types.AuthConfig) error {
|
||||||
dec := json.NewDecoder(pullResponse)
|
dec := json.NewDecoder(pullResponse)
|
||||||
for {
|
for {
|
||||||
m := map[string]interface{}{}
|
m := map[string]interface{}{}
|
||||||
if err := dec.Decode(&m); err != nil {
|
err := dec.Decode(&m)
|
||||||
|
if err != nil {
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
// if the stream contains an error, return it
|
||||||
|
if val, ok := m["error"]; ok {
|
||||||
|
if errmsg, strok := val.(string); strok {
|
||||||
|
return errors.New(errmsg)
|
||||||
|
}
|
||||||
|
return errors.New("Error while downloading image")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// force refresh images
|
// force refresh images
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue