Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
Check returns the "err" when it is considered non-nil, otherwise nil. If it is a group then the group is returned when that or any of its children contains an 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 any `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 any
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.