mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 12:21:26 -07:00
Handle errors in jmespath in json_query better (#22109)
* Handle errors in jmespath in json_query better Catch any exceptions raised from jmespath and raise an AnsibleFilterError instead. Avoid a traceback. Fixes #20379 * pep8
This commit is contained in:
parent
d3ecf3efb7
commit
01c0b2f714
4 changed files with 122 additions and 5 deletions
|
@ -440,7 +440,6 @@ class Base(with_metaclass(BaseMeta, object)):
|
|||
|
||||
# and assign the massaged value back to the attribute field
|
||||
setattr(self, name, value)
|
||||
|
||||
except (TypeError, ValueError) as e:
|
||||
raise AnsibleParserError("the field '%s' has an invalid value (%s), and could not be converted to an %s."
|
||||
"The error was: %s" % (name, value, attribute.isa, e), obj=self.get_ds(), orig_exc=e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue