package multierr
import "tailscale.com/util/multierr"
Package multierr provides a simple multiple-error type. It was inspired by github.com/go-multierror/multierror.
Index ¶
Functions ¶
func New ¶
New returns an error composed from errs. Some errors in errs get special treatment:
- nil errors are discarded
- errors of type Error are expanded into the top level
If the resulting slice has length 0, New returns nil. If the resulting slice has length 1, New returns that error. If the resulting slice has length > 1, New returns that slice as an Error.
func Range ¶
Range performs a pre-order, depth-first iteration of the error tree by successively unwrapping all error values. For each iteration it calls fn with the current error value and stops iteration if it ever reports false.
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
An Error represents multiple errors.
func (Error) As ¶
As finds the first error in e that matches target, and if any is found, sets target to that error value and returns true. Otherwise, it returns false.
func (Error) Error ¶
Error implements the error interface.
func (Error) Errors ¶
Errors returns a slice containing all errors in e.
func (Error) Is ¶
Is reports whether any error in e matches target.
func (Error) Unwrap ¶
Unwrap returns the underlying errors as-is.
Source Files ¶
multierr.go
- Version
- v1.84.0 (latest)
- Published
- May 21, 2025
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 1 day ago –
Tools for package owners.