From ebba84b085591c182b72437ca4126dee1263202e Mon Sep 17 00:00:00 2001 From: atom-tr Date: Fri, 13 Oct 2023 21:53:26 +0700 Subject: [PATCH] exit if error --- src/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.py b/src/main.py index 193f818..eb418ca 100644 --- a/src/main.py +++ b/src/main.py @@ -85,6 +85,7 @@ def main(): if __name__ == '__main__': + error = False start_time = datetime.now() logger.g("Program execution started at $date.", date=start_time) try: @@ -93,6 +94,9 @@ def main(): except Exception as e: logger.p("Program execution failed with error: $error.", error=e) print("status=failed") + error = True end_time = datetime.now() logger.g("Program execution finished at $date.", date=end_time) - logger.p("Program finished in $time.", time=end_time - start_time) + logger.p("Program finished in $time.", time=end_time - start_time) + if error: + exit(1)