Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New creates a MultiError from a list of errors.
This is just a convenience wrapper to ensure that if there is no error, if errs has len() == 0, or all errors are nil, nil is returned.
In facts, you could normally convert a []error{} into a MultiError by simply using a cast: MultiError(errs). However, a simple cast would lead to a non nil error when errs has lenght 0.
Types ¶
type MultiError ¶
type MultiError []error
func (MultiError) As ¶
func (me MultiError) As(target interface{}) bool
As for MultiError returns the first error that can be considered As the specified target.
func (MultiError) Error ¶
func (me MultiError) Error() string
func (MultiError) Is ¶
func (me MultiError) Is(target error) bool
Is for MultiError returns true if any of the errors listed can be considered of the target type.
func (MultiError) Unwrap ¶
func (me MultiError) Unwrap() error
Unwrap for MultiError always returns nil, as there is no reasonable way to implement it.
Use As and Is methods, or loop over the list directly to access the underlying errors.