#disnake.HTTPException

1 messages · Page 1 of 1 (latest)

naive frigate
#

The error isn't being caught, not sure what im doing wrong here.

    @Cog.listener()
    async def on_slash_command_error(self, inter: disnake.ApplicationCommandInteraction, error):
        if isinstance(error, errors.CommandOnCooldown):
            num = round(error.retry_after, 0)
            await inter.edit_original_message(
                f"This command is on cooldown. Try again in {num} seconds.",
            )

        elif isinstance(error, disnake.HTTPException):
            await inter.edit_original_message(
                "That vanity is either invalid or taken.",
            )
#
Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In code: Invite code is either invalid or taken.

still receiving this

quick sleet
#

Show whole traceback

rose grove
#

@naive frigatepretty sure that you can get a wrapped CommandError or whatever it was that has the HTTPException internally

#

-src Error Handler

unreal basinBOT
#
Cog: Error Handler

Handles all errors across the bot.

Source Code
quick sleet
#

I think it is CommandInvokeError

unreal basinBOT
#

monty/exts/backend/error_handler.py lines 167 to 168

elif isinstance(error, (commands.CommandInvokeError, commands.ConversionError)):
    if isinstance(error.original, disnake.Forbidden):
quick sleet
#

raise RuntimeError("how was this even reached") mmlolbutbadlydrawn

naive frigate
#

way better than my current setup lmao.

#

okay so im using it, but I still want to return a specific for HTTPException because of invalid vanity or it being taken

#

oh wait

#

ok figured it out. thank you guys