mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #29491 from yongtang/12162016-stats-error
Improve error output for `docker stats ...`
This commit is contained in:
commit
d65d5db2a0
1 changed files with 3 additions and 4 deletions
|
@ -173,14 +173,13 @@ func runStats(dockerCli *command.DockerCli, opts *statsOptions) error {
|
||||||
var errs []string
|
var errs []string
|
||||||
cStats.mu.Lock()
|
cStats.mu.Lock()
|
||||||
for _, c := range cStats.cs {
|
for _, c := range cStats.cs {
|
||||||
cErr := c.GetError()
|
if err := c.GetError(); err != nil {
|
||||||
if cErr != nil {
|
errs = append(errs, err.Error())
|
||||||
errs = append(errs, fmt.Sprintf("%s: %v", c.Name, cErr))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cStats.mu.Unlock()
|
cStats.mu.Unlock()
|
||||||
if len(errs) > 0 {
|
if len(errs) > 0 {
|
||||||
return fmt.Errorf("%s", strings.Join(errs, ", "))
|
return fmt.Errorf("%s", strings.Join(errs, "\n"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue