Printing full traceback for error testing
This commit is contained in:
parent
227a09e566
commit
347da70ed0
1 changed files with 4 additions and 3 deletions
7
bot.py
7
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))
|
||||
|
|
Loading…
Reference in a new issue