Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error []error
func Append ¶
Append adds err2 to err1. - If err1 and err2 are nil, returns nil - If err1 is nil, returns an Error with only err2 - If err2 is nil, returns an Error with only err1 - If err1 is an Error, it returns a copy with err2 appended - Otherwise, returns a new Error with err1 and err2 as the sole elements NOTE: unlike `err1.Append`, this does not mutate err1.
func (*Error) Append ¶
Append will mutate e and append the error. Will no-op if `err == nil`. Typical usage should be via auto-referencing [syntax sugar](https://go.dev/ref/spec#Calls):
var e Error e.Append(err)
func (Error) As ¶
As implements the interface used in errors.As by iterating through the members returning true on the first match.
func (Error) ErrOrNil ¶
ErrOrNil is used to convert this multierr into a [error]. This is necessary because it is a typed nil
func example() error { var e Error return e } if example() != nil { ! this will run! }
in otherwords,
(Error)(nil) != nil
Additionally, if there's only a single error, it will automatically unwrap it.
func (Error) Is ¶
Is implements the interface used in errors.Is by iterating through the members returning true on the first match.
func (Error) Unwrap ¶
Unwrap implements the interface used in errors.Unwrap