mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Handle TemplateNotFound to render more helpful error message.
At the point the exception is handled, it is likely due to error loading a sub-template included from main template. Besides file not found, it can be caused also by include path failing Jinja2 checks. Now, when rendering the exception from Jinja, it will include exception name. This will give basic context or *what* the error is. Fixes #7103 Fixes #7105
This commit is contained in:
committed by
James Cammarata
parent
52c7d50f1e
commit
f8bf9cdeec
@@ -87,7 +87,7 @@ class ActionModule(object):
|
||||
try:
|
||||
resultant = template.template_from_file(self.runner.basedir, source, inject, vault_password=self.runner.vault_pass)
|
||||
except Exception, e:
|
||||
result = dict(failed=True, msg=str(e))
|
||||
result = dict(failed=True, msg=type(e).__name__ + ": " + str(e))
|
||||
return ReturnData(conn=conn, comm_ok=False, result=result)
|
||||
|
||||
local_md5 = utils.md5s(resultant)
|
||||
|
||||
Reference in New Issue
Block a user