Adds traceback logging to task exception handling (#3517)

This commit is contained in:
Flame442 2020-02-06 15:46:54 -08:00 committed by GitHub
parent 8d73838d80
commit 246f9ce17f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -430,7 +430,10 @@ def global_exception_handler(red, loop, context):
msg = context.get("exception", context["message"]) msg = context.get("exception", context["message"])
# These will get handled later when it *also* kills loop.run_forever # These will get handled later when it *also* kills loop.run_forever
if not isinstance(msg, (KeyboardInterrupt, SystemExit)): if not isinstance(msg, (KeyboardInterrupt, SystemExit)):
log.critical("Caught unhandled exception in task: %s", msg) if isinstance(msg, Exception):
log.critical("Caught unhandled exception in task:\n", exc_info=msg)
else:
log.critical("Caught unhandled exception in task: %s", msg)
def red_exception_handler(red, red_task: asyncio.Future): def red_exception_handler(red, red_task: asyncio.Future):