Merge pull request #14445 from marcpo/maint/display_string_causing_exception

Display the string which is causing an exception to be raised.
pull/14192/merge
James Cammarata 9 years ago
commit c485981d1a

@ -464,7 +464,7 @@ class Templar:
try: try:
t = myenv.from_string(data) t = myenv.from_string(data)
except TemplateSyntaxError as e: except TemplateSyntaxError as e:
raise AnsibleError("template error while templating string: %s" % str(e)) raise AnsibleError("template error while templating string: %s. String: %s" % (str(e), data))
except Exception as e: except Exception as e:
if 'recursion' in str(e): if 'recursion' in str(e):
raise AnsibleError("recursive loop detected in template string: %s" % data) raise AnsibleError("recursive loop detected in template string: %s" % data)

Loading…
Cancel
Save