aboutsummaryrefslogtreecommitdiffstats
path: root/bot/seasons/evergreen/error_handler.py
diff options
context:
space:
mode:
authorGravatar Joseph Banks <[email protected]>2020-03-25 23:57:23 +0000
committerGravatar Joseph Banks <[email protected]>2020-03-25 23:57:23 +0000
commitf2ca5d13e07ab0136b51d6b863a3f59791c15a7f (patch)
tree4ce6ec6383458db84b53771fd284f8200e75f272 /bot/seasons/evergreen/error_handler.py
parentMerge pull request #378 from python-discord/update-contrib (diff)
Setup Sentry
Diffstat (limited to 'bot/seasons/evergreen/error_handler.py')
-rw-r--r--bot/seasons/evergreen/error_handler.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/bot/seasons/evergreen/error_handler.py b/bot/seasons/evergreen/error_handler.py
index 0d8bb0bb..2753a6df 100644
--- a/bot/seasons/evergreen/error_handler.py
+++ b/bot/seasons/evergreen/error_handler.py
@@ -5,6 +5,7 @@ from typing import Iterable, Union
from discord import Embed, Message
from discord.ext import commands
+from sentry_sdk import push_scope
from bot.constants import Colours, ERROR_REPLIES, NEGATIVE_REPLIES
from bot.decorators import InChannelCheckFailure
@@ -97,7 +98,25 @@ class CommandErrorHandler(commands.Cog):
await ctx.send(embed=self.error_embed("You are not authorized to use this command.", NEGATIVE_REPLIES))
return
- log.exception(f"Unhandled command error: {str(error)}", exc_info=error)
+ with push_scope() as scope:
+ scope.user = {
+ "id": ctx.author.id,
+ "username": str(ctx.author)
+ }
+
+ scope.set_tag("command", ctx.command.qualified_name)
+ scope.set_tag("message_id", ctx.message.id)
+ scope.set_tag("channel_id", ctx.channel.id)
+
+ scope.set_extra("full_message", ctx.message.content)
+
+ if ctx.guild is not None:
+ scope.set_extra(
+ "jump_to",
+ f"https://discordapp.com/channels/{ctx.guild.id}/{ctx.channel.id}/{ctx.message.id}"
+ )
+
+ log.exception(f"Unhandled command error: {str(error)}", exc_info=error)
def setup(bot: commands.Bot) -> None: