diff --git a/sizebot/extensions/errorhandler.py b/sizebot/extensions/errorhandler.py index 8df53639..57448c2f 100644 --- a/sizebot/extensions/errorhandler.py +++ b/sizebot/extensions/errorhandler.py @@ -38,18 +38,18 @@ async def on_command_error(ctx: BotContext, error: commands.CommandError): if isinstance(err, errors.DigiContextException): # DigiContextException handling message = await err.formatMessage(ctx) - if message is not None: - logger.log(err.level, message) - logger.error(utils.format_traceback(error)) + # if message is not None: + # logger.log(err.level, message) + # logger.error(utils.format_traceback(error)) userMessage = await err.formatUserMessage(ctx) if userMessage is not None: await ctx.send(f"{emojis.warning} {userMessage}") elif isinstance(err, errors.DigiException): # DigiException handling message = err.formatMessage() - if message is not None: - logger.log(err.level, message) - logger.error(utils.format_traceback(error)) + # if message is not None: + # logger.log(err.level, message) + # logger.error(utils.format_traceback(error)) userMessage = err.formatUserMessage() if userMessage is not None: await ctx.send(f"{emojis.warning} {userMessage}") @@ -72,8 +72,8 @@ async def on_command_error(ctx: BotContext, error: commands.CommandError): else: # Default command error handling await ctx.send(f"{emojis.error} Something went wrong.") - logger.error(f"Ignoring exception in command {ctx.command}:") - logger.error(utils.format_traceback(error)) + logger.error(f"Ignoring exception in command {ctx.command}:") + logger.error(utils.format_traceback(error)) @bot.event async def on_error(event: discord.DiscordException, *args, **kwargs): diff --git a/sizebot/lib/digidecimal.py b/sizebot/lib/digidecimal.py index a62f42b5..62f77cd6 100644 --- a/sizebot/lib/digidecimal.py +++ b/sizebot/lib/digidecimal.py @@ -164,7 +164,10 @@ def __radd__(self, other: BaseDecimal | int) -> BaseDecimal: def __sub__(self, other: BaseDecimal | int) -> BaseDecimal: rawvalue = unwrap_decimal(self) rawother = unwrap_decimal(other) - return BaseDecimal(rawvalue - rawother) + try: + return BaseDecimal(rawvalue - rawother) + except decimal.InvalidOperation as e: + return BaseDecimal(0) @abstractmethod def __rsub__(self, other: BaseDecimal | int) -> BaseDecimal: