Skip to content

Improve logging messages during exception handling

Given the following code:

import time
import datetime as dt
from scheduler import Scheduler


def fail():
    raise TimeoutError

schedule = Scheduler()
schedule.cyclic(dt.timedelta(seconds=1), fail)

for _ in range(1):
    time.sleep(1)
    schedule.exec_jobs()

The following message is being logged:

Unhandled exception `` in `scheduler.Job(...)`!

Expected behavior: Instead of an empty string there should be a hint about the TimeoutError being raised.