mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-11-03 15:25:19 +00:00
Update a few dependencies
github.com/go-openapi/* github.com/asaskevich/govalidator
This commit is contained in:
20
vendor/github.com/asaskevich/govalidator/error.go
generated
vendored
20
vendor/github.com/asaskevich/govalidator/error.go
generated
vendored
@@ -1,5 +1,7 @@
|
||||
package govalidator
|
||||
|
||||
import "strings"
|
||||
|
||||
// Errors is an array of multiple errors and conforms to the error interface.
|
||||
type Errors []error
|
||||
|
||||
@@ -9,11 +11,11 @@ func (es Errors) Errors() []error {
|
||||
}
|
||||
|
||||
func (es Errors) Error() string {
|
||||
var err string
|
||||
var errs []string
|
||||
for _, e := range es {
|
||||
err += e.Error() + ";"
|
||||
errs = append(errs, e.Error())
|
||||
}
|
||||
return err
|
||||
return strings.Join(errs, ";")
|
||||
}
|
||||
|
||||
// Error encapsulates a name, an error and whether there's a custom error message or not.
|
||||
@@ -21,11 +23,21 @@ type Error struct {
|
||||
Name string
|
||||
Err error
|
||||
CustomErrorMessageExists bool
|
||||
|
||||
// Validator indicates the name of the validator that failed
|
||||
Validator string
|
||||
Path []string
|
||||
}
|
||||
|
||||
func (e Error) Error() string {
|
||||
if e.CustomErrorMessageExists {
|
||||
return e.Err.Error()
|
||||
}
|
||||
return e.Name + ": " + e.Err.Error()
|
||||
|
||||
errName := e.Name
|
||||
if len(e.Path) > 0 {
|
||||
errName = strings.Join(append(e.Path, e.Name), ".")
|
||||
}
|
||||
|
||||
return errName + ": " + e.Err.Error()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user