1
0
Fork 0
mirror of synced 2024-06-15 09:04:33 +12:00

Printing full traceback for error testing

This commit is contained in:
phxntxm 2016-07-15 18:11:36 -05:00
parent 3b1551aab5
commit 227a09e566

5
bot.py
View file

@ -62,10 +62,13 @@ async def on_command_error(error, ctx):
elif isinstance(error, commands.CheckFailure):
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)
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))
await bot.send_message(ctx.message.channel, "```{}```".format(traceback.format_exc()))
if __name__ == '__main__':
for e in extensions: