github.com/keltia/go-ipfs@v0.3.8-0.20150909044612-210793031c63/thirdparty/multierr/multierr.go (about) 1 package multierr 2 3 import ( 4 "fmt" 5 ) 6 7 // Error contains a set of errors. Used to return multiple errors, as in listen. 8 type Error struct { 9 Errors []error 10 } 11 12 func (e *Error) Error() string { 13 if e == nil { 14 return "<nil error>" 15 } 16 var out string 17 for i, v := range e.Errors { 18 if v != nil { 19 out += fmt.Sprintf("%d: %s\n", i, v) 20 } 21 } 22 return out 23 } 24 25 func New(errs ...error) *Error { 26 return &Error{errs} 27 }