load and reload command errors available with the [p]traceback command (#1307)

This commit is contained in:
retke 2018-02-19 04:18:56 +01:00 committed by Kowlin
parent a0327a62dd
commit 3984cb8f48

View File

@ -3,6 +3,7 @@ import importlib
import itertools
import logging
import sys
import traceback
from collections import namedtuple
from random import SystemRandom
from string import ascii_letters, digits
@ -229,6 +230,13 @@ class Core:
await ctx.bot.load_extension(spec)
except Exception as e:
log.exception("Package loading failed", exc_info=e)
exception_log = ("Exception in command '{}'\n"
"".format(ctx.command.qualified_name))
exception_log += "".join(traceback.format_exception(type(e),
e, e.__traceback__))
self.bot._last_exception = exception_log
await ctx.send(_("Failed to load package. Check your console or "
"logs for details."))
else:
@ -264,6 +272,13 @@ class Core:
await ctx.bot.load_extension(spec)
except Exception as e:
log.exception("Package reloading failed", exc_info=e)
exception_log = ("Exception in command '{}'\n"
"".format(ctx.command.qualified_name))
exception_log += "".join(traceback.format_exception(type(e),
e, e.__traceback__))
self.bot._last_exception = exception_log
await ctx.send(_("Failed to reload package. Check your console or "
"logs for details."))
else: