From b3435e3316702d4c6708c51103867e3dde777c41 Mon Sep 17 00:00:00 2001 From: Myned Date: Sat, 14 Oct 2017 15:29:01 -0400 Subject: [PATCH] Overrode on_error to close connections and open terminal with traceback --- src/main/run.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/run.py b/src/main/run.py index 6de0b5f..93d72c9 100644 --- a/src/main/run.py +++ b/src/main/run.py @@ -43,10 +43,21 @@ async def on_ready(): print('- - - - - - -') +@bot.event +async def on_error(error): + if u.session: + await u.session.close() + await bot.logout() + await bot.close() + print('- - - - - - -') + print('ERROR') + tb.print_exc() + + @bot.event async def on_command_error(ctx, error): if not isinstance(error, commands.errors.CommandNotFound): - print(error) + tb.print_exception(type(error), error, error.__traceback__, file=sys.stderr) await ctx.send('{}\n```\n{}```'.format(exc.base, error))