Merge pull request #14537 from Yannig/devel_better_error_handling
Improve message content to get more hint about the raised error.
This commit is contained in:
commit
b901b15d3b
1 changed files with 7 additions and 1 deletions
|
@ -21,6 +21,7 @@ __metaclass__ = type
|
||||||
|
|
||||||
from ansible.compat.six import iteritems
|
from ansible.compat.six import iteritems
|
||||||
from jinja2.utils import missing
|
from jinja2.utils import missing
|
||||||
|
from ansible.utils.unicode import to_unicode
|
||||||
|
|
||||||
__all__ = ['AnsibleJ2Vars']
|
__all__ = ['AnsibleJ2Vars']
|
||||||
|
|
||||||
|
@ -83,7 +84,12 @@ class AnsibleJ2Vars:
|
||||||
if isinstance(variable, dict) and varname == "vars" or isinstance(variable, HostVars):
|
if isinstance(variable, dict) and varname == "vars" or isinstance(variable, HostVars):
|
||||||
return variable
|
return variable
|
||||||
else:
|
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):
|
def add_locals(self, locals):
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in a new issue