Printing full traceback for error testing
This commit is contained in:
parent
3b1551aab5
commit
227a09e566
5
bot.py
5
bot.py
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue