Documentation ¶
Index ¶
- func Check(err error) error
- func Walk(err error, visitor func(typ interface{}, err error)) error
- type Error
- type Group
- func (g *Group) Add(err error)
- func (g *Group) Addf(format string, args ...interface{}) error
- func (g *Group) Err(err error) error
- func (g *Group) Errf(format string, args ...interface{}) error
- func (g *Group) Error() (s string)
- func (g *Group) Group(typ interface{}) *Group
- func (g *Group) Unwrap() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
Check reports whether the "err" is not nil. If it is a group then it returns true if that or its children contains any error.
func Walk ¶
Walk loops through each of the errors of "err". If "err" is *Group then it fires the "visitor" for each of its errors, including children. if "err" is *Error then it fires the "visitor" with its type and wrapped error. Otherwise it fires the "visitor" once with typ of nil and err as "err".
Types ¶
type Error ¶
type Error struct { Err error `json:"error" xml:"Error" yaml:"Error" toml:"Error" sql:"error"` Type interface{} `json:"type" xml:"Type" yaml:"Type" toml:"Type" sql:"type"` }
Error implements the error interface. It is a special error type which keep the "Type" of the Group that it's created through Group's `Err` and `Errf` methods.
type Group ¶
type Group struct { Type interface{} Errors []error // []*Error // if true then this Group's Error method will return the messages of the errors made by this Group's Group method. // Defaults to true. IncludeChildren bool // it clones. // contains filtered or unexported fields }
Group is an error container of a specific Type and can have child containers per type too.
func (*Group) Err ¶
Err adds an error to the group, it transforms it to an Error type if necessary and returns it.