diff options
| author | 2020-02-21 03:05:23 +0000 | |
|---|---|---|
| committer | 2020-02-21 03:05:23 +0000 | |
| commit | 03175ae8bfcb70b1b2c798267fdd23b48534b2b7 (patch) | |
| tree | 5f85049fcd8246100b05fbd2b5f308caefc0c13b | |
| parent | Set BOT_SENTRY_DSN environment variable for tests (diff) | |
Attach extra information on a command error
| -rw-r--r-- | bot/cogs/error_handler.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/bot/cogs/error_handler.py b/bot/cogs/error_handler.py index 52893b2ee..021753081 100644 --- a/bot/cogs/error_handler.py +++ b/bot/cogs/error_handler.py @@ -15,6 +15,7 @@ from discord.ext.commands import ( UserInputError, ) from discord.ext.commands import Cog, Context +from sentry_sdk import configure_scope from bot.api import ResponseCodeError from bot.bot import Bot @@ -150,7 +151,18 @@ class ErrorHandler(Cog): log.error( f"Error executing command invoked by {ctx.message.author}: {ctx.message.content}" ) - raise e + + with configure_scope() as scope: + scope.user = { + "username": ctx.author.username, + "id": ctx.author.id + } + + scope.set_tag("command", ctx.command.qualified_name) + scope.set_tag("message_id", ctx.message.id) + scope.set_extra("full_message", ctx.message.content) + + raise e def setup(bot: Bot) -> None: |