multierr

package
v1.26.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2022 License: BSD-3-Clause Imports: 2 Imported by: 48

Documentation

Overview

Package multierr provides a simple multiple-error type. It was inspired by github.com/go-multierror/multierror.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(errs ...error) error

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.

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

An Error represents multiple errors.

func (Error) As

func (e Error) As(target any) bool

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

func (e Error) Error() string

Error implements the error interface.

func (Error) Errors

func (e Error) Errors() []error

Errors returns a slice containing all errors in e.

func (Error) Is

func (e Error) Is(target error) bool

Is reports whether any error in e matches target.

Jump to

Keyboard shortcuts

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