You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
454 B
Go

10 years ago
package main
import (
10 years ago
"strings"
10 years ago
)
const (
E_Ok int = iota
E_No_Data
10 years ago
E_No_DB
E_No_Port
10 years ago
)
type errorGroup []error
func (e errorGroup) Error() string {
10 years ago
messages := make([]string, 0, len(e))
for i, _ := range e {
messages[i] = e[i].Error()
}
return strings.Join(messages, " && ")
10 years ago
}
func (g *errorGroup) AddError(err error) {
10 years ago
if err == nil {
return
}
if g == nil {
panic("fart")
*g = make([]error, 0, 4)
}
*g = append(*g, err)
10 years ago
}