mirror of
https://github.com/yannh/kubeconform.git
synced 2026-04-14 00:14:45 +00:00
Invalid JSON should not be considered an error - see https://github.com/yannh/kubeconform/issues/67 (#327)
This commit is contained in:
parent
3134f4477e
commit
a23275d5ca
4 changed files with 26 additions and 3 deletions
|
|
@ -56,7 +56,7 @@ func (l *HTTPURLLoader) Load(url string) (any, error) {
|
|||
|
||||
s, err := jsonschema.UnmarshalJSON(bytes.NewReader(body))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, NewNonJSONResponseError(err)
|
||||
}
|
||||
|
||||
return s, nil
|
||||
|
|
|
|||
|
|
@ -10,3 +10,13 @@ func NewNotFoundError(err error) *NotFoundError {
|
|||
}
|
||||
func (e *NotFoundError) Error() string { return e.err.Error() }
|
||||
func (e *NotFoundError) Retryable() bool { return false }
|
||||
|
||||
type NonJSONResponseError struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NewNonJSONResponseError(err error) *NotFoundError {
|
||||
return &NotFoundError{err}
|
||||
}
|
||||
func (e *NonJSONResponseError) Error() string { return e.err.Error() }
|
||||
func (e *NonJSONResponseError) Retryable() bool { return false }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue