Skip to content

Commit

Permalink
exit if error
Browse files Browse the repository at this point in the history
  • Loading branch information
atom-tr committed Oct 13, 2023
1 parent 641b9c1 commit ebba84b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)

0 comments on commit ebba84b

Please sign in to comment.