mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-12 00:30:11 +00:00
Add exception handler logging more info to command wrapper
This commit is contained in:
parent
034f7816e4
commit
0fbe957b9c
1 changed files with 4 additions and 0 deletions
|
|
@ -8,6 +8,8 @@ import pluralkit
|
||||||
from pluralkit import db
|
from pluralkit import db
|
||||||
from pluralkit.bot import utils
|
from pluralkit.bot import utils
|
||||||
|
|
||||||
|
logger = logging.getLogger("pluralkit.bot.commands")
|
||||||
|
|
||||||
command_list = {}
|
command_list = {}
|
||||||
|
|
||||||
class InvalidCommandSyntax(Exception):
|
class InvalidCommandSyntax(Exception):
|
||||||
|
|
@ -63,6 +65,8 @@ def command(cmd, usage=None, description=None, category=None, system_required=Tr
|
||||||
except CommandError as e:
|
except CommandError as e:
|
||||||
embed = e.message if isinstance(e.message, discord.Embed) else utils.make_error_embed(e.message)
|
embed = e.message if isinstance(e.message, discord.Embed) else utils.make_error_embed(e.message)
|
||||||
await client.send_message(message.channel, embed=embed)
|
await client.send_message(message.channel, embed=embed)
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Exception while handling command {} (args={}, system={})".format(cmd, args, system.hid if system else "(none)"))
|
||||||
|
|
||||||
# Put command in map
|
# Put command in map
|
||||||
command_list[cmd] = CommandEntry(command=cmd, function=wrapper, usage=usage, description=description, category=category)
|
command_list[cmd] = CommandEntry(command=cmd, function=wrapper, usage=usage, description=description, category=category)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue