Merge pull request #118989 from crenshaw-dev/better-error-message

chore: improve error message for unstructured helper method
This commit is contained in:
Kubernetes Prow Robot 2023-08-15 15:17:34 -07:00 committed by GitHub
commit 5c365939bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,7 +173,7 @@ func NestedStringMap(obj map[string]interface{}, fields ...string) (map[string]s
if str, ok := v.(string); ok {
strMap[k] = str
} else {
return nil, false, fmt.Errorf("%v accessor error: contains non-string key in the map: %v is of the type %T, expected string", jsonPath(fields), v, v)
return nil, false, fmt.Errorf("%v accessor error: contains non-string value in the map under key %q: %v is of the type %T, expected string", jsonPath(fields), k, v, v)
}
}
return strMap, true, nil