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.

            Source Files