From 5083645b95ea5d3a58ff4189b0f19e134b44829b Mon Sep 17 00:00:00 2001 From: andig Date: Mon, 22 Jul 2024 09:01:17 +0200 Subject: [PATCH] Yaml: handle type error due to invalid content (#14964) --- server/db/settings/setting.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/db/settings/setting.go b/server/db/settings/setting.go index d0d1d81297..5a02fd42cb 100644 --- a/server/db/settings/setting.go +++ b/server/db/settings/setting.go @@ -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 {