mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-31 07:43:09 +00:00
[template/vars] Use to_native(exception) as a fallback for Python 3 which doesn't have a .message attribute (#34044)
This commit is contained in:
@@ -105,7 +105,10 @@ class AnsibleJ2Vars(Mapping):
|
||||
try:
|
||||
value = self._templar.template(variable)
|
||||
except Exception as e:
|
||||
raise type(e)(to_native(variable) + ': ' + e.message)
|
||||
try:
|
||||
raise type(e)(to_native(variable) + ': ' + e.message)
|
||||
except AttributeError:
|
||||
raise type(e)(to_native(variable) + ': ' + to_native(e))
|
||||
return value
|
||||
|
||||
def add_locals(self, locals):
|
||||
|
||||
Reference in New Issue
Block a user