From 347da70ed03d87672f6cadf3a0d9b94cce3ae351 Mon Sep 17 00:00:00 2001 From: phxntxm Date: Fri, 15 Jul 2016 18:13:12 -0500 Subject: [PATCH] Printing full traceback for error testing --- bot.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bot.py b/bot.py index f465b09..8228ba3 100644 --- a/bot.py +++ b/bot.py @@ -63,9 +63,10 @@ async def on_command_error(error, ctx): fmt = "You can't tell me what to do!" await bot.send_message(ctx.message.channel, fmt) elif isinstance(error, commands.CommandInvokeError): - print('In {0.command.qualified_name}:'.format(ctx), file=sys.stderr) - traceback.print_tb(error.original.__traceback__) - print('{0.__class__.__name__}: {0}'.format(error.original), file=sys.stderr) + fmt = 'In {0.command.qualified_name}:'.format(ctx), file=sys.stderr + fmt += error.original.__traceback__ + fmt += '{0.__class__.__name__}: {0}'.format(error.original), file=sys.stderr + await bot.send_message(ctx.message.channel,"```{}```".format(fmt)) else: fmt = 'An error occurred while processing this request: ```py\n{}: {}\n```' await bot.send_message(ctx.message.channel, fmt.format(type(error).__name__, error))