From 246f9ce17f3b347d3f5b01441bc999f96b38c859 Mon Sep 17 00:00:00 2001 From: Flame442 <34169552+Flame442@users.noreply.github.com> Date: Thu, 6 Feb 2020 15:46:54 -0800 Subject: [PATCH] Adds traceback logging to task exception handling (#3517) --- redbot/__main__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/redbot/__main__.py b/redbot/__main__.py index a15b9d2a6..d0abd0643 100644 --- a/redbot/__main__.py +++ b/redbot/__main__.py @@ -430,7 +430,10 @@ def global_exception_handler(red, loop, context): msg = context.get("exception", context["message"]) # These will get handled later when it *also* kills loop.run_forever 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):