Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
/ multierror Public archive

Go package implementing an error that can contain multiple errors

License

Notifications You must be signed in to change notification settings

efixler/multierror

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

multierror

Go package implementing an error that can contain multiple errors

Go Documentation

multierror wraps multiple errors into a typed slice that implements Go's error interface. It's useful for iterators that don't bail when they encounter an error, but still need to return error information to the caller.

multierror.MultiError aims toward leanness and is mainly utilized with a combination of error and slice semantics.

Installation

go get github.com/efixler/multierror

Usage

import (
	"github.com/efixler/multierror"
)

func Worker() error {
   merr := multierror.New()
   for _, item := range work {
	 err := doSomething()
	 if err != nil {
	   merr = append(merr, err)
	 }
    }
    return merr.NilWhenEmpty()
 }

See the Godoc for details and more examples.

About

Go package implementing an error that can contain multiple errors

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages