mirror of
https://github.com/go-i2p/go-i2p.git
synced 2025-07-04 21:55:18 -04:00
20 lines
427 B
Go
20 lines
427 B
Go
package data
|
|
|
|
import "fmt"
|
|
|
|
// WrapErrors compiles a slice of errors and returns them wrapped together as a single error.
|
|
func WrapErrors(errs []error) error {
|
|
var err error
|
|
for i, e := range errs {
|
|
err = fmt.Errorf("%v\n\t%d: %v", err, i, e)
|
|
}
|
|
return err
|
|
}
|
|
|
|
// PrintErrors prints a formatted list of errors to the console.
|
|
func PrintErrors(errs []error) {
|
|
for i, e := range errs {
|
|
fmt.Printf("\t%d: %v\n", i, e)
|
|
}
|
|
}
|