multierror

package module
v0.0.0-...-f1cbf3e Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2019 License: MIT Imports: 2 Imported by: 1

README

Don't use this anymore!

The uber multierr package has a cleaner design and also supports go 1.13 errors.Is and errors.As.

Use that.


multierror

GoDoc

A simple error accumulator for Go.

Documentation

Overview

Package multierror defines an error Accumulator to contain multiple errors.

Use Uber's Multierr

It has a cleaner and more consistent design than this package: https://godoc.org/go.uber.org/multierr

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accumulator

type Accumulator []error

Accumulator is an error accumulator.

Usage:

var errors multierror.Accumulator
errors.Push(returnsErrOrNil())
errors.Push(returnsErrOrNil())
errors.Push(returnsErrOrNil())
return errors.Error()

func (*Accumulator) Error

func (m *Accumulator) Error() error

Error returns the accumulated errors. If no errors have been pushed onto the accumulator, then nil will be returned.

func (*Accumulator) Push

func (m *Accumulator) Push(err error)

Push adds an error to the Accumulator. If err is nil, then Accumulator is not affected.

func (*Accumulator) Pushf

func (m *Accumulator) Pushf(fmtstr string, args ...interface{})

Pushf adds a formatted error string to the Accumulator. It is a shortcut for Push(fmt.Error(...)).

func (Accumulator) String

func (m Accumulator) String() string

String prints the accumulated errors or "nil" if no errors have been pushed.

Jump to

Keyboard shortcuts

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