prometheus/vendor/github.com/asaskevich/govalidator/error.go

30 lines
470 B
Go
Raw Normal View History

2016-01-25 05:30:04 +00:00
package govalidator
type Errors []error
func (es Errors) Errors() []error {
return es
}
func (es Errors) Error() string {
var err string
for _, e := range es {
err += e.Error() + ";"
}
return err
}
type Error struct {
2016-04-24 08:13:39 +00:00
Name string
Err error
CustomErrorMessageExists bool
2016-01-25 05:30:04 +00:00
}
func (e Error) Error() string {
2016-04-24 08:13:39 +00:00
if e.CustomErrorMessageExists {
return e.Err.Error()
} else {
return e.Name + ": " + e.Err.Error()
}
2016-01-25 05:30:04 +00:00
}