1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Improve message content to get more hint about the raised error.

This commit is contained in:
Yannig Perré 2016-02-17 21:30:34 +01:00
parent 91f3558c64
commit 588045cc46

View file

@ -21,6 +21,7 @@ __metaclass__ = type
from ansible.compat.six import iteritems
from jinja2.utils import missing
from ansible.utils.unicode import to_unicode
__all__ = ['AnsibleJ2Vars']
@ -83,7 +84,12 @@ class AnsibleJ2Vars:
if isinstance(variable, dict) and varname == "vars" or isinstance(variable, HostVars):
return variable
else:
return self._templar.template(variable)
value = None
try:
value = self._templar.template(variable)
except Exception as e:
raise type(e)(to_unicode(variable) + ': ' + e.message)
return value
def add_locals(self, locals):
'''