mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Catch the raised exception so we can report failure (#42072)
Avoid the _undefined name_ and mirror lines 389 and 459 by catching the raised exception in the variable __exc__ so it can be reported on the following line. flake8 testing of https://github.com/ansible/ansible on Python 3.6.3 $ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__ ``` ./lib/ansible/module_utils/network/iosxr/iosxr.py:414:42: F821 undefined name 'exc' module.fail_json(msg=to_text(exc)) ^ ```
This commit is contained in:
parent
52e7946de5
commit
61d5454737
1 changed files with 1 additions and 1 deletions
|
@ -410,7 +410,7 @@ def load_config(module, command_filter, commit=False, replace=False,
|
|||
|
||||
try:
|
||||
conn.edit_config(cmd_filter)
|
||||
except ConnectionError:
|
||||
except ConnectionError as exc:
|
||||
module.fail_json(msg=to_text(exc))
|
||||
|
||||
if module._diff:
|
||||
|
|
Loading…
Reference in a new issue