Skip to content

Exceptions

All RevvLink exceptions inherit from RevvLinkException. Catch this base class to handle any library error, or catch specific subclasses for finer control.

RevvLinkException (base)
├── PenaltySystemNotActiveException
├── NodeException
├── InvalidClientException
├── AuthorizationFailedException
├── InvalidNodeException
├── LavalinkException
├── LavalinkLoadException
├── InvalidChannelStateException
├── ChannelTimeoutException
└── QueueEmpty

RevvLinkException

Bases: Exception

Base revvlink Exception class.

All revvlink exceptions derive from this exception.


PenaltySystemNotActiveException

Bases: RevvLinkException

Exception raised when connecting to a node without an active penalty system.


NodeException

NodeException(
    msg: str | None = None, status: int | None = None
)

Bases: RevvLinkException

Error raised when an Unknown or Generic error occurs on a Node.

This exception may be raised when an error occurs reaching your Node.

Attributes:

Name Type Description
status int | None

The status code received when making a request. Could be None.


InvalidClientException

Bases: RevvLinkException

Exception raised when an invalid :class:discord.Client is provided while connecting a :class:revvlink.Node.


AuthorizationFailedException

Bases: RevvLinkException

Exception raised when Lavalink fails to authenticate a :class:~revvlink.Node, with the provided password.


InvalidNodeException

Bases: RevvLinkException

Exception raised when a :class:Node is tried to be retrieved from the :class:Pool without existing, or the Pool is empty.

This exception is also raised when providing an invalid node to :meth:~revvlink.Player.switch_node.


LavalinkException

LavalinkException(
    msg: str | None = None, /, *, data: ErrorResponse
)

Bases: RevvLinkException

Exception raised when Lavalink returns an invalid response.

Attributes:

Name Type Description
status int

The response status code.

reason str | None

The response reason. Could be None if no reason was provided.


LavalinkLoadException

LavalinkLoadException(
    msg: str | None = None, /, *, data: LoadedErrorPayload
)

Bases: RevvLinkException

Exception raised when an error occurred loading tracks via Lavalink.

Attributes:

Name Type Description
error str

The error message from Lavalink.

severity str

The severity of this error sent via Lavalink.

cause str

The cause of this error sent via Lavalink.


InvalidChannelStateException

Bases: RevvLinkException

Exception raised when a :class:~revvlink.Player tries to connect to an invalid channel or has invalid permissions to use this channel.


ChannelTimeoutException

Bases: RevvLinkException

Exception raised when connecting to a voice channel times out.


QueueEmpty

Bases: RevvLinkException

Exception raised when you try to retrieve from an empty queue.


Common Patterns

# Catch any RevvLink error
try:
    await player.play(track)
except revvlink.RevvLinkException as e:
    print(f"Error: {e}")

# Handle empty queue
try:
    next_track = player.queue.get()
except revvlink.QueueEmpty:
    await ctx.send("No more tracks.")

# Handle Lavalink API failures
try:
    results = await revvlink.Playable.search(query)
except revvlink.LavalinkLoadException as e:
    await ctx.send(f"Could not load tracks ({e.severity}): {e.error}")
except revvlink.LavalinkException as e:
    await ctx.send(f"Lavalink error {e.status}: {e.error}")