github.com/ssdev-go/moby@v17.12.1-ce-rc2+incompatible/cli/error.go (about) 1 package cli 2 3 import ( 4 "fmt" 5 "strings" 6 ) 7 8 // Errors is a list of errors. 9 // Useful in a loop if you don't want to return the error right away and you want to display after the loop, 10 // all the errors that happened during the loop. 11 type Errors []error 12 13 func (errList Errors) Error() string { 14 if len(errList) < 1 { 15 return "" 16 } 17 18 out := make([]string, len(errList)) 19 for i := range errList { 20 out[i] = errList[i].Error() 21 } 22 return strings.Join(out, ", ") 23 } 24 25 // StatusError reports an unsuccessful exit by a command. 26 type StatusError struct { 27 Status string 28 StatusCode int 29 } 30 31 func (e StatusError) Error() string { 32 return fmt.Sprintf("Status: %s, Code: %d", e.Status, e.StatusCode) 33 }