Async Error Swallowed (ARCH2169)
Esta página aún no está disponible en tu idioma.
Key python.logging.async-error-swallowed · Severity warning · Category logging
Unawaited coroutines and fire-and-forget tasks let the exceptions inside them vanish silently. The task fails but it is never noticed or logged anywhere.
Incorrect
Section titled “Incorrect”async def handle(req): asyncio.create_task(send_notification(req)) return ok()Correct
Section titled “Correct”async def handle(req): task = asyncio.create_task(send_notification(req)) task.add_done_callback( lambda t: t.exception() and logger.error("Notification failed", exc_info=t.exception()) ) return ok()Await the task, or attach a done-callback that catches and logs the exception.