multierror

package
v0.0.0-...-bd88772 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package multierror contains code to manage multiple errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Union

type Union struct {
	Children []error
	Root     error
}

Union is the logical union of several errors. The Union will appear to be the Root error, except that it will actually be possible to look deeper and see specific sub errors that occurred using errors.As and errors.Is.

func New

func New(root error) *Union

New creates a new Union error instance.

func (*Union) Add

func (err *Union) Add(child error)

Add adds the specified child error to the Union error.

func (*Union) AddWithPrefix

func (err *Union) AddWithPrefix(prefix string, child error)

AddWithPrefix adds the specified child error to the Union error with the specified prefix before the child error.

func (Union) Error

func (err Union) Error() string

Error returns a string representation of the Union error.

func (Union) Is

func (err Union) Is(target error) bool

Is returns whether the Union error contains at least one child error that is exactly the specified target error.

func (Union) Unwrap

func (err Union) Unwrap() error

Unwrap returns the Root error of the Union error.

Jump to

Keyboard shortcuts

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