{"modulePath":"github.com/unitytech/client-go","version":"v2.0.0+incompatible","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package errors\n\nPackage errors implements various utility functions and types around errors.\n\n## Variables\n\n```go\nvar ErrPreconditionViolated = errors.New(\"precondition is violated\")\n```\nErrPreconditionViolated is returned when the precondition is violated\n\n## Functions\n\n```go\nfunc FilterOut(err error, fns ...Matcher) error\n```\nFilterOut 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.\n\nThis can be used, for example, to remove known-OK errors (such as io.EOF or os.PathNotFound) from a list of errors.\n\n```go\nfunc Reduce(err error) error\n```\nReduce will return err or, if err is an Aggregate and only has one item, the first item in the aggregate.\n\n## Types\n\n```go\ntype Aggregate interface {\n\terror\n\tErrors() []error\n}\n```\nAggregate represents an object that contains multiple errors, but does not necessarily have singular semantic meaning.\n\n```go\nfunc AggregateGoroutines(funcs ...func() error) Aggregate\n```\nAggregateGoroutines runs the provided functions in parallel, stuffing all non-nil errors into the returned Aggregate. Returns nil if all the functions complete successfully.\n\n```go\nfunc Flatten(agg Aggregate) Aggregate\n```\nFlatten takes an Aggregate, which may hold other Aggregates in arbitrary nesting, and flattens them all into a single Aggregate, recursively.\n\n```go\nfunc NewAggregate(errlist []error) Aggregate\n```\nNewAggregate 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. It will check if any of the element of input error list is nil, to avoid nil pointer panic when call Error().\n\n```go\ntype Matcher func(error) bool\n```\nMatcher is used to match errors.  Returns true if the error matches.\n\n","path":"github.com/unitytech/client-go/pkg/util/errors","name":"errors","synopsis":"Package errors implements various utility functions and types around errors.","isRedistributable":true}
