v1.0.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2015 License: Apache-2.0 Imports: 1 Imported by: 0



Package errors implements various utility functions and types around errors.



This section is empty.


This section is empty.


func FilterOut

func FilterOut(err error, fns ...Matcher) error

FilterOut removes all errors that match any of the matchers from the input error. If the input is a singular error, only that error is tested. If the input implements the Aggregate interface, the list of errors will be processed recursively.

This can be used, for example, to remove known-OK errors (such as io.EOF or os.PathNotFound) from a list of errors.


type Aggregate

type Aggregate interface {
	Errors() []error

Aggregate represents an object that contains multiple errors, but does not necessarily have singular semantic meaning.

func Flatten

func Flatten(agg Aggregate) Aggregate

Flatten takes an Aggregate, which may hold other Aggregates in arbitrary nesting, and flattens them all into a single Aggregate, recursively.

func NewAggregate

func NewAggregate(errlist []error) Aggregate

NewAggregate converts a slice of errors into an Aggregate interface, which is itself an implementation of the error interface. If the slice is empty, this returns nil.

type Matcher

type Matcher func(error) bool

Matcher is used to match errors. Returns true if the error matches.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL