Skip to content

Commit 384c30c

Browse files
committed
Improved error message
1 parent 9cd9c97 commit 384c30c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

internal/go-configmap/configuration.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,12 @@ func tryConversion(current any, desiredType reflect.Type) (any, error) {
109109
}
110110
return currentArray, nil
111111
}
112-
return nil, fmt.Errorf("invalid conversion, got %T but want %v", current, desiredType)
112+
113+
currentTypeString := currentType.String()
114+
if currentTypeString == "[]interface {}" {
115+
currentTypeString = "array"
116+
}
117+
return nil, fmt.Errorf("invalid conversion, got %s but want %v", currentTypeString, desiredType)
113118
}
114119

115120
func (c Map) set(keys []string, value any) {

0 commit comments

Comments
 (0)