-1

I have this error.

discord.errors.ClientException: Already playing audio.

This is what I have done to catch the error

    @commands.Cog.listener()
    async def on_error(self, err):
        if isinstance(err, commands.ClientException()):
            print("Client Exception")

I would also like to check if "Already playing audio" is in this 'ClientException: Already playing audio'. But how do I get the message out of the Exception?

Jaxon. B
  • 92
  • 6

2 Answers2

0

You can do err.message to print the message from exception. You can also refer to this link python exception message capturing

Owais_Raxa
  • 36
  • 2
0

This will print the exception message if there is any exception.

try:
    ans = 'hi' + 5
except Exception as e:
    print(e)
can only concatenate str (not "int") to str

You can do something like this in your code.

Ram
  • 4,724
  • 2
  • 14
  • 22