7 // Error is an error type to track multiple errors. This is used to
8 // accumulate errors in cases and return them as a single "error".
11 ErrorFormat ErrorFormatFunc
14 func (e *Error) Error() string {
23 // ErrorOrNil returns an error interface if this Error represents
24 // a list of errors, or returns nil if the list of errors is empty. This
25 // function is useful at the end of accumulation to make sure that the value
26 // returned represents the existence of errors.
27 func (e *Error) ErrorOrNil() error {
31 if len(e.Errors) == 0 {
38 func (e *Error) GoString() string {
39 return fmt.Sprintf("*%#v", *e)
42 // WrappedErrors returns the list of errors that this Error is wrapping.
43 // It is an implementation of the errwrap.Wrapper interface so that
44 // multierror.Error can be used with that library.
46 // This method is not safe to be called concurrently and is no different
47 // than accessing the Errors field directly. It is implemented only to
48 // satisfy the errwrap.Wrapper interface.
49 func (e *Error) WrappedErrors() []error {