Skip to content

A small library for errors collecting.

License

fschnko/errpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoDoc Build Status Coverage Status Go Report Card

errpack

Package errpack declares the Pack type for errors collecting. This is useful for cyclic or unrelated operations when journaling is not allowed (library packages, etc.).


Usage:

go get github.com/fschnko/repeat

Example:

	errp := errpack.New("test error pack")
	errp.Add(
		func() error { return errors.New("func fail") }(),              // always fails.
		func() error { return nil }(),                                  // always succeed.
		func(msg string) error { return errors.New(msg) }("new error"), // returns new error with message.
	)

	for _, err := range errp.Errors() {
		fmt.Printf("%s : %s\n", errp.Name(), err)
	}
	// Output:
	// test error pack : func fail
	// test error pack : new error

About

A small library for errors collecting.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages