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/repeatExample:
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