Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Error ¶
type Error interface { error // Errors returns underlying errors. Errors() []error // As finds the first error in multiError slice of error chains that matches target, and if so, sets // target to that error value and returns true. Otherwise, it returns false. // // An error matches target if the error's concrete value is assignable to the value // pointed to by target, or if the error has a method As(interface{}) bool such that // As(target) returns true. In the latter case, the As method is responsible for // setting target. As(target interface{}) bool // Is returns true if any error in multiError's slice of error chains matches the given target or // if the target is of multiError type. // // An error is considered to match a target if it is equal to that target or if // it implements a method Is(error) bool such that Is(target) returns true. Is(target error) bool // Count returns the number of multi error' errors that match the given target. // Matching is defined as in Is method. Count(target error) int }
Error is extended error interface that allows to use returned read-only multi error in more advanced ways.
type NilOrMultiError ¶
type NilOrMultiError struct {
// contains filtered or unexported fields
}
NilOrMultiError type allows combining multiple errors into one.
func New ¶
func New(errs ...error) *NilOrMultiError
New returns NilOrMultiError with provided errors added if not nil.
func (*NilOrMultiError) Add ¶
func (e *NilOrMultiError) Add(errs ...error)
Add adds single or many errors to the error list. Each error is added only if not nil. If the error is a multiError type, the errors inside multiError are added to the main NilOrMultiError.
func (NilOrMultiError) Err ¶
func (e NilOrMultiError) Err() Error
Err returns the error list as an Error (also implements error) or nil if it is empty.
Click to show internal directories.
Click to hide internal directories.