Skip to content

Commit

Permalink
fix error message in export
Browse files Browse the repository at this point in the history
  • Loading branch information
vieux committed May 13, 2013
1 parent 908e479 commit 8b31d30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion api.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func getContainersExport(srv *Server, w http.ResponseWriter, r *http.Request, va

if err := srv.ContainerExport(name, w); err != nil {
Debugf("%s", err.Error())
//return nil, err
return err
}
return nil
}
Expand Down
8 changes: 8 additions & 0 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,14 @@ func stream(method, path string) error {
return err
}
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode >= 400 {
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
return fmt.Errorf("error: %s", body)
}

if _, err := io.Copy(os.Stdout, resp.Body); err != nil {
return err
}
Expand Down

0 comments on commit 8b31d30

Please sign in to comment.