Wrap unhandled errors from lookups in an AnsibleError
This provides better error handling, and prevents errors like KeyError
from bubbliing up to code in odd places.
Fixes #17482
(cherry picked from commit 85bbce9d6b
)
This commit is contained in:
parent
f821d3a9f6
commit
20df246504
1 changed files with 1 additions and 1 deletions
|
@ -417,7 +417,7 @@ class Templar:
|
||||||
raise AnsibleUndefinedVariable(e)
|
raise AnsibleUndefinedVariable(e)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if self._fail_on_lookup_errors:
|
if self._fail_on_lookup_errors:
|
||||||
raise
|
raise AnsibleError("An unhandled exception occurred while running the lookup plugin '%s'. Error was a %s, original message: %s" % (name, type(e), e))
|
||||||
ran = None
|
ran = None
|
||||||
|
|
||||||
if ran:
|
if ran:
|
||||||
|
|
Loading…
Reference in a new issue