Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MultiError ¶
type MultiError struct {
Errors []error
}
MultiError is a collection of errors that implements the error interface.
Example:
errs := &errors.MultiError{}
errs.Append(err1, err2)
if err := errs.ErrorOrNil(); err != nil { ... }
func (*MultiError) Append ¶
func (e *MultiError) Append(errs ...error)
Append adds errors to the collection. Nil errors are ignored.
func (*MultiError) Error ¶
func (e *MultiError) Error() string
Error implements the error interface.
Returns:
A concatenated string of all error messages, separated by semicolons.
func (*MultiError) ErrorOrNil ¶
func (e *MultiError) ErrorOrNil() error
ErrorOrNil returns nil if there are no errors, otherwise returns itself.
func (*MultiError) HasErrors ¶
func (e *MultiError) HasErrors() bool
HasErrors returns true if there are any errors in the collection.
func (*MultiError) Unwrap ¶
func (e *MultiError) Unwrap() []error
Unwrap returns the errors as a slice for errors.Is/As support (Go 1.20+).
Click to show internal directories.
Click to hide internal directories.