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
34 lines
454 B
Go
package main
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
const (
|
|
E_Ok int = iota
|
|
E_No_Data
|
|
E_No_DB
|
|
E_No_Port
|
|
)
|
|
|
|
type errorGroup []error
|
|
|
|
func (e errorGroup) Error() string {
|
|
messages := make([]string, 0, len(e))
|
|
for i, _ := range e {
|
|
messages[i] = e[i].Error()
|
|
}
|
|
return strings.Join(messages, " && ")
|
|
}
|
|
|
|
func (g *errorGroup) AddError(err error) {
|
|
if err == nil {
|
|
return
|
|
}
|
|
if g == nil {
|
|
panic("fart")
|
|
*g = make([]error, 0, 4)
|
|
}
|
|
*g = append(*g, err)
|
|
}
|