Documentation ¶
Overview ¶
Package errutil offers various types and funcs to help with some common ways of using errors.
Index ¶
- type ErrMap
- func (em *ErrMap) AddError(cat string, err error)
- func (em ErrMap) CategorySummary(cat string) string
- func (em ErrMap) CountErrors() (int, int)
- func (em ErrMap) HasErrors() bool
- func (em ErrMap) Keys() []string
- func (em ErrMap) Matches(other ErrMap) error
- func (em ErrMap) Report(w io.Writer, name string)
- func (em ErrMap) Summary() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrMap ¶
ErrMap is a type that maps a string to a list of errors. It is useful for the case where you want to return more than one error and want to group them in some way for reporting. Each map entry represents a category for which some errors have been found.
func (ErrMap) CategorySummary ¶
CategorySummary returns a summary description of the errors in the ErrMap for the given category
func (ErrMap) CountErrors ¶
CountErrors counts the total number of errors and the number of categories (in that order)
func (ErrMap) HasErrors ¶ added in v1.2.0
HasErrors returns true if there are any errors in the map, false otherwise.
func (ErrMap) Matches ¶ added in v1.1.0
Matches returns an error if the two ErrMaps differ, nil otherwise