jmespath search, catch JMESPathTypeError error

This error can happend if we search for a key and try to make a value compare and the key does not exist.
Perhaps also when they key should return a list
This commit is contained in:
Clemens Schwaighofer
2025-10-09 16:39:54 +09:00
parent 2f4e236350
commit c1eda7305b

View File

@@ -28,6 +28,8 @@ def jmespath_search(search_data: dict[Any, Any] | list[Any], search_params: str)
raise ValueError(f"Compile failed: {search_params}: {excp}") from excp
except jmespath.exceptions.ParseError as excp:
raise ValueError(f"Parse failed: {search_params}: {excp}") from excp
except jmespath.exceptions.JMESPathTypeError as excp:
raise ValueError(f"Search failed with JMESPathTypeError: {search_params}: {excp}") from excp
except TypeError as excp:
raise ValueError(f"Type error for search_params: {excp}") from excp
return search_result