mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: update kubernetes to v1.23.0
updating go dependency to latest kubernetes released version i.e v1.23.0 Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
42403e2ba7
commit
5762da3e91
33
vendor/k8s.io/apimachinery/pkg/runtime/error.go
generated
vendored
33
vendor/k8s.io/apimachinery/pkg/runtime/error.go
generated
vendored
@ -19,6 +19,7 @@ package runtime
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
@ -124,20 +125,30 @@ func IsMissingVersion(err error) bool {
|
||||
// strictDecodingError is a base error type that is returned by a strict Decoder such
|
||||
// as UniversalStrictDecoder.
|
||||
type strictDecodingError struct {
|
||||
message string
|
||||
data string
|
||||
errors []error
|
||||
}
|
||||
|
||||
// NewStrictDecodingError creates a new strictDecodingError object.
|
||||
func NewStrictDecodingError(message string, data string) error {
|
||||
func NewStrictDecodingError(errors []error) error {
|
||||
return &strictDecodingError{
|
||||
message: message,
|
||||
data: data,
|
||||
errors: errors,
|
||||
}
|
||||
}
|
||||
|
||||
func (e *strictDecodingError) Error() string {
|
||||
return fmt.Sprintf("strict decoder error for %s: %s", e.data, e.message)
|
||||
var s strings.Builder
|
||||
s.WriteString("strict decoding error: ")
|
||||
for i, err := range e.errors {
|
||||
if i != 0 {
|
||||
s.WriteString(", ")
|
||||
}
|
||||
s.WriteString(err.Error())
|
||||
}
|
||||
return s.String()
|
||||
}
|
||||
|
||||
func (e *strictDecodingError) Errors() []error {
|
||||
return e.errors
|
||||
}
|
||||
|
||||
// IsStrictDecodingError returns true if the error indicates that the provided object
|
||||
@ -149,3 +160,13 @@ func IsStrictDecodingError(err error) bool {
|
||||
_, ok := err.(*strictDecodingError)
|
||||
return ok
|
||||
}
|
||||
|
||||
// AsStrictDecodingError returns a strict decoding error
|
||||
// containing all the strictness violations.
|
||||
func AsStrictDecodingError(err error) (*strictDecodingError, bool) {
|
||||
if err == nil {
|
||||
return nil, false
|
||||
}
|
||||
strictErr, ok := err.(*strictDecodingError)
|
||||
return strictErr, ok
|
||||
}
|
||||
|
Reference in New Issue
Block a user