chore: improve error message for unstructured helper method

This commit is contained in:
Michael Crenshaw 2023-06-29 16:39:55 -04:00
parent 3180aa4272
commit fc36d2fee8
No known key found for this signature in database
GPG Key ID: F7D2408DB7526312

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