cli/error.go
4f0d95fa
 package cli // import "github.com/docker/docker/cli"
f3711704
 
14712f9f
 import (
 	"fmt"
 	"strings"
 )
f3711704
 
 // Errors is a list of errors.
 // Useful in a loop if you don't want to return the error right away and you want to display after the loop,
 // all the errors that happened during the loop.
 type Errors []error
 
d6d448aa
 func (errList Errors) Error() string {
 	if len(errList) < 1 {
f3711704
 		return ""
 	}
d6d448aa
 
 	out := make([]string, len(errList))
 	for i := range errList {
 		out[i] = errList[i].Error()
f3711704
 	}
d6d448aa
 	return strings.Join(out, ", ")
f3711704
 }
14712f9f
 
 // StatusError reports an unsuccessful exit by a command.
 type StatusError struct {
 	Status     string
 	StatusCode int
 }
 
 func (e StatusError) Error() string {
 	return fmt.Sprintf("Status: %s, Code: %d", e.Status, e.StatusCode)
 }