Skip to content

Commit e168512

Browse files
committed
Added exception outuput in scheduling task
1 parent e26458b commit e168512

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

gmail_birthday_sender/main.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ def run(self):
9090

9191
schedule.every().day.at("07:00").do(birthday_sender.run)
9292

93-
while True:
94-
schedule.run_pending()
95-
time.sleep(1)
93+
try:
94+
while True:
95+
schedule.run_pending()
96+
time.sleep(1)
97+
except KeyboardInterrupt:
98+
print("Birthday sending stopped")
99+
except Exception as e:
100+
print(f"An error: {e}")

0 commit comments

Comments
 (0)