An exception in a Python async task is not immediately reported. It will be reported when the future corresponding to the task is awaited, but in some cases (e.g., tasks designed to run indefinitely) that is not convenient.

In this case it is possible to check for the exception simply by:

if tsk.done():

where tsk is the future associated with the task. Note that done() will return True if the task has an exception set.