Source code for discodo.errors

from http.client import responses


[docs]class DiscodoException(Exception): """The basic exception class of discodo""" ...
[docs]class EncryptModeNotReceived(DiscodoException): """Exception that is thrown when trying to send packet before receveing encrypt mode. It's only raise in :py:class:`DiscordVoiceClient`""" ...
[docs]class NotPlaying(DiscodoException): """Exception that is thrown when trying to operate something while not playing.""" ...
[docs]class VoiceClientNotFound(DiscodoException): """Exception that is thrown when there is no voice client.""" ...
[docs]class NoSearchResults(DiscodoException): """Exception that is thrown when there is no search results.""" ...
[docs]class OpusLoadError(DiscodoException): """Exception that is thrown when loading libopus failed.""" ...
[docs]class HTTPException(DiscodoException): """Exception that is thrown when HTTP operation failed. :var int status: HTTP status code :var str description: Description of the HTTP status code :var str message: Server message with this request""" def __init__(self, status: int, data=None) -> None: if not data: data = {} self.status = data.get("status", status) self.description = data.get( "description", responses.get(status, "Unknown Status Code") ) self.message = data.get("message", "") super().__init__(f"{self.status} {self.description}: {self.message}")
[docs]class Forbidden(DiscodoException): """Exception that is thrown when HTTP status code is 403.""" ...
[docs]class TooManyRequests(DiscodoException): """Exception that is thrown when HTTP status code is 429.""" ...
[docs]class NotSeekable(DiscodoException): """Exception that is thrown when trying to seek the source which is not seekable.""" ...
[docs]class NodeException(DiscodoException): """Exception that is thrown when discodo node returns some exception.""" def __init__(self, name, reason) -> None: self.name = name self.reason = reason super().__init__(f"{name}{': ' if reason else ''}{reason}")
[docs]class NodeNotConnected(DiscodoException): """Exception that is thrown when there is no discodo node that is connected.""" ...