aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-11-17 16:29:39 +0200
committerGravatar ks129 <[email protected]>2020-11-17 16:29:39 +0200
commit83b4a1b2feefc61678c12143a0eed30b2908f2e2 (patch)
tree886d5921d40d025f0157848478e7a0dc412b6fc5
parentCreate mock_in_debug decorator for branding (diff)
Handle branding error in error handler
-rw-r--r--bot/exts/backend/error_handler.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/bot/exts/backend/error_handler.py b/bot/exts/backend/error_handler.py
index c643d346e..6fb5bcf98 100644
--- a/bot/exts/backend/error_handler.py
+++ b/bot/exts/backend/error_handler.py
@@ -1,5 +1,6 @@
import contextlib
import logging
+import random
import typing as t
from discord import Embed
@@ -8,9 +9,9 @@ from sentry_sdk import push_scope
from bot.api import ResponseCodeError
from bot.bot import Bot
-from bot.constants import Channels, Colours
+from bot.constants import Channels, Colours, ERROR_REPLIES
from bot.converters import TagNameConverter
-from bot.errors import LockedResourceError
+from bot.errors import LockedResourceError, BrandingError
from bot.utils.checks import InWhitelistCheckFailure
log = logging.getLogger(__name__)
@@ -78,6 +79,9 @@ class ErrorHandler(Cog):
await self.handle_api_error(ctx, e.original)
elif isinstance(e.original, LockedResourceError):
await ctx.send(f"{e.original} Please wait for it to finish and try again later.")
+ elif isinstance(e.original, BrandingError):
+ await ctx.send(embed=self._get_error_embed(random.choice(ERROR_REPLIES), str(e.original)))
+ return
else:
await self.handle_unexpected_error(ctx, e.original)
return # Exit early to avoid logging.