Yaml: handle type error due to invalid content (#14964)
Some checks failed
Some checks failed
This commit is contained in:
parent
5d540f6a02
commit
5083645b95
1 changed files with 2 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ import (
|
|||
"cmp"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
"slices"
|
||||
|
|
@ -200,7 +201,7 @@ func DecodeOtherSliceOrMap(other, res any) error {
|
|||
if typ := reflect.TypeOf(other); typ.Kind() == reflect.Slice || typ.Kind() == reflect.Map {
|
||||
len = reflect.ValueOf(other).Len()
|
||||
} else {
|
||||
panic("invalid kind: " + typ.Kind().String())
|
||||
return fmt.Errorf("cannot decode into slice or map: %v", other)
|
||||
}
|
||||
|
||||
if len == 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue