Returning error when Image Pull fails

Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
This commit is contained in:
Nishant Totla 2016-04-06 18:01:38 -07:00
parent 40456d0926
commit af5ce4bdb0
No known key found for this signature in database
GPG Key ID: 7EA5781C9B3D0C19
1 changed files with 9 additions and 1 deletions

View File

@ -991,12 +991,20 @@ func (e *Engine) Pull(image string, authConfig *types.AuthConfig) error {
dec := json.NewDecoder(pullResponse)
for {
m := map[string]interface{}{}
if err := dec.Decode(&m); err != nil {
err := dec.Decode(&m)
if err != nil {
if err == io.EOF {
break
}
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