Skip to content

Commit

Permalink
Merge pull request moby#29491 from yongtang/12162016-stats-error
Browse files Browse the repository at this point in the history
Improve error output for `docker stats ...`
  • Loading branch information
cpuguy83 authored Dec 21, 2016
2 parents b2e348f + 32de162 commit d65d5db
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cli/command/container/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,13 @@ func runStats(dockerCli *command.DockerCli, opts *statsOptions) error {
var errs []string
cStats.mu.Lock()
for _, c := range cStats.cs {
cErr := c.GetError()
if cErr != nil {
errs = append(errs, fmt.Sprintf("%s: %v", c.Name, cErr))
if err := c.GetError(); err != nil {
errs = append(errs, err.Error())
}
}
cStats.mu.Unlock()
if len(errs) > 0 {
return fmt.Errorf("%s", strings.Join(errs, ", "))
return fmt.Errorf("%s", strings.Join(errs, "\n"))
}
}

Expand Down

0 comments on commit d65d5db

Please sign in to comment.