55import traceback
66
77from getgauge .exceptions import SkipScenarioException
8- from getgauge .messages .messages_pb2 import ExecutionStatusResponse , Message
8+ from getgauge .messages .messages_pb2 import ExecutionStatusResponse
99from getgauge .messages .spec_pb2 import ProtoExecutionResult
10- from getgauge .registry import MessagesStore , ScreenshotsStore , registry
10+ from getgauge .registry import MessagesStore , ScreenshotsStore
1111
1212
1313def create_execution_status_response ():
@@ -24,24 +24,27 @@ def run_hook(request, hooks, execution_info):
2424 return response
2525
2626
27- def _false (func , exception ): return False
27+ def _false (func , exception ):
28+ return False
2829
2930
3031def execute_method (params , step , response , is_continue_on_failure = _false ):
3132 start = _current_time ()
3233 try :
3334 params = _get_args (params , step )
3435 step .impl (* params )
35- except SkipScenarioException :
36+ except SkipScenarioException as e :
3637 response .executionResult .skipScenario = True
38+ MessagesStore .write_message (str (e ))
3739 except Exception as e :
3840 _add_exception (e , response , is_continue_on_failure (step .impl , e ))
3941 response .executionResult .executionTime = _current_time () - start
4042 response .executionResult .message .extend (MessagesStore .pending_messages ())
4143 response .executionResult .screenshotFiles .extend (ScreenshotsStore .pending_screenshots ())
4244
4345
44- def _current_time (): return int (round (time .time () * 1000 ))
46+ def _current_time ():
47+ return int (round (time .time () * 1000 ))
4548
4649
4750def _get_args (params , hook_or_step ):
@@ -60,7 +63,7 @@ def _add_exception(e, response, continue_on_failure):
6063 screenshot = ScreenshotsStore .capture_to_file ()
6164 response .executionResult .failureScreenshotFile = screenshot
6265 response .executionResult .failed = True
63- message = e . __str__ ( )
66+ message = str ( e )
6467 if not message :
6568 message = "Exception occurred"
6669 response .executionResult .errorMessage = message
0 commit comments