Skip to content

Commit

Permalink
Fix message on should_fail
Browse files Browse the repository at this point in the history
  • Loading branch information
a-belhadj authored and Sispheor committed Mar 6, 2023
1 parent 4f937c0 commit dc2e77f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions plugins/module_utils/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@
class MonkeybleException(Exception):
def __init__(self, message, scenario_description=None, exit_code=1):
super().__init__(message)
global_display.display(msg=f"❌ MONKEYBLE ERROR ❌", color=C.COLOR_ERROR)
if scenario_description is not None:
global_display.display(msg=f"🙊 Failed scenario: {scenario_description}", color=C.COLOR_ERROR)
global_display.display(msg=message, color=C.COLOR_ERROR)
if exit_code == 0:
color = C.COLOR_OK
else:
color = C.COLOR_ERROR
global_display.display(msg=f"❌ MONKEYBLE ERROR ❌", color=color)
if scenario_description is not None:
global_display.display(
msg=f"🙊 Failed scenario: {scenario_description}", color=color)
global_display.display(msg=message, color=color)
sys.exit(exit_code)

0 comments on commit dc2e77f

Please sign in to comment.