Some vulnerable dependencies upgraded
* golang.org/x/net to v0.8.0 * golang.org/x/crypto to v0.0.0-20220314234659-1baeb1ce4c0b * github.com/aws/aws-sdk-go to v1.34.0 * github.com/prometheus/client_golang to v1.14.0 * k8s.io/client-go to v0.23.0
This commit is contained in:
1 parent
c241c455c5
commit
df2240acbd
3024 files changed
+403882
-96802
No files matched your search
+27
-6
@@ -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