multierror

package
v0.0.1-really Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2019 License: Apache-2.0 Imports: 3 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MultiError

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

MultiError is a mechanism for capturing errors from parallel go-routines. Usage:

errs := NewMultiError(3)
do := func(f foo) error {...}
for foo in range foos {
    go errs.capture(do(foo))
}
// Wait for completion

Will gather all errors returned in a MultiError, which in turn will behave as a normal error.

func NewMultiError

func NewMultiError(max int) *MultiError

NewMultiError creates a new MultiError struct.

func (*MultiError) Add

func (me *MultiError) Add(err error)

Add captures an error from a go-routine and adds it to the MultiError.

func (*MultiError) Err

func (me *MultiError) Err() error

Err returns an non-nil error representing all reported errors. Err returns nil when no errors where reported.

func (*MultiError) Error

func (me *MultiError) Error() string

Error returns a string version of the MultiError. This implements the error interface.

Jump to

Keyboard shortcuts

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