error.go 449 B

1234567891011121314151617181920
  1. package cli
  2. import "strings"
  3. // Errors is a list of errors.
  4. // Useful in a loop if you don't want to return the error right away and you want to display after the loop,
  5. // all the errors that happened during the loop.
  6. type Errors []error
  7. func (errList Errors) Error() string {
  8. if len(errList) < 1 {
  9. return ""
  10. }
  11. out := make([]string, len(errList))
  12. for i := range errList {
  13. out[i] = errList[i].Error()
  14. }
  15. return strings.Join(out, ", ")
  16. }