base: Index | Files

package multierror

import ""


Package Files


type MultiError Uses

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 Uses

func NewMultiError(max int) *MultiError

NewMultiError creates a new MultiError struct.

func (*MultiError) Add Uses

func (me *MultiError) Add(err error)

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

func (*MultiError) Err Uses

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 Uses

func (me *MultiError) Error() string

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

Package multierror imports 3 packages (graph) and is imported by 2 packages. Updated 2019-01-08. Refresh now. Tools for package owners.