diff options
Diffstat (limited to 'arthur/bot.py')
-rw-r--r-- | arthur/bot.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/arthur/bot.py b/arthur/bot.py index 8acf6fe..9a51298 100644 --- a/arthur/bot.py +++ b/arthur/bot.py @@ -8,9 +8,11 @@ from discord.ext import commands from kubernetes_asyncio import config from kubernetes_asyncio.config.kube_config import KUBE_CONFIG_DEFAULT_LOCATION from pydis_core import BotBase +from sentry_sdk import push_scope -from arthur import exts, logger +from arthur import exts from arthur.config import CONFIG +from arthur.log import logger class KingArthur(BotBase): @@ -60,3 +62,12 @@ class KingArthur(BotBase): return False return CONFIG.devops_role in [r.id for r in user.roles] + + async def on_error(self, event_name: str, *args: Any, **kwargs: Any) -> None: + """Log errors raised in event listeners.""" + with push_scope() as scope: + scope.set_tag("event", event_name) + scope.set_extra("args", args) + scope.set_extra("kwargs", kwargs) + + logger.exception(f"Unhandled exception during event: {event_name}.") |