Reorder float error message so path is at the end, fixes #410

The `path` where a float is detected can be quite long.  Some tools like
Sentry can truncate the error message so the useful error message is
removed.

This makes troubleshooting more challenging and less obvious.  Moving the path to
the end makes it clearer what the error is and where to start looking
for the problem.
This commit is contained in:
Benson Wong 2023-04-12 13:58:49 -07:00
Родитель a231587169
Коммит b85f2b90a5
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -379,7 +379,7 @@ def prevent_float_value(event, resources):
path = f"{path}.{k}" if path else k
if isinstance(v, float):
raise ValueError(
f"'{path}' field contains float value (tip: use integer or string)"
f"field contains float value (tip: use integer or string), '{path}'"
)
elif isinstance(v, (list, dict)):
scan(v, path)