Documentation
¶
Overview ¶
Package errx provides small error-handling helpers, such as MultiError.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MultiError ¶
type MultiError []error
MultiError is a slice of errors implementing the error interface.
func (*MultiError) Append ¶
func (errs *MultiError) Append(err error)
Append appends the provided error if it is not nil.
func (MultiError) Error ¶
func (errs MultiError) Error() string
Error formats the contained errors as a bullet point list, preceded by the total number of errors. Note that this results in a multi-line string.
func (MultiError) IsEmpty ¶
func (errs MultiError) IsEmpty() bool
IsEmpty returns true if MultiError has no errors, otherwise false.
func (MultiError) MaybeUnwrap ¶
func (errs MultiError) MaybeUnwrap() error
MaybeUnwrap returns nil if len(errs) is 0. It returns the first and only contained error as error if len(errs is 1). In all other cases, it returns the MultiError directly. This is helpful for returning a MultiError in a way that only uses the MultiError if needed.