Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Append ¶
Append appends the given errors together. Either value may be nil.
This function is a specialization of Combine for the common case where there are only two errors.
err = multierr.Append(reader.Close(), writer.Close())
The following pattern may also be used to record failure of deferred operations without losing information about the original error.
func doSomething(..) (err error) { f := acquireResource() defer func() { err = multierr.Append(err, f.Close()) }()
Types ¶
type Error ¶
type MultiError ¶
type MultiError struct {
// contains filtered or unexported fields
}
MultiError is an error that holds one or more errors.
An instance of this is guaranteed to be non-empty and flattened. That is, none of the errors inside MultiError are other MultiErrors.
MultiError formats to a semi-colon delimited list of error messages with %v and with a more readable multi-line format with %+v.
func (*MultiError) As ¶
func (merr *MultiError) As(target interface{}) bool
func (*MultiError) Error ¶
func (merr *MultiError) Error() string
func (*MultiError) Errors ¶
func (merr *MultiError) Errors() []error
Errors returns the list of underlying errors.
This slice MUST NOT be modified.
func (*MultiError) Is ¶
func (merr *MultiError) Is(target error) bool