Source code for harmonize.exceptions
[docs]
class HarmonizeException(Exception):
"""
Base class for Harmonize exceptions.
Tip
---
When catching errors, you can use this error class without using all other error classes
"""
[docs]
class AuthorizationError(HarmonizeException):
"""
Represents an authorization error. Throws when authorization fails.
"""
[docs]
class NodeUnknownError(HarmonizeException):
"""
Represents a node unknown error. Throws at 404 status.
"""
[docs]
class Forbidden(HarmonizeException):
"""
Represents an authentication error. Throws when authorization fails or forbidden status
"""
def __init__(self, name: str) -> None:
super().__init__(f"The node {name} is forbidden")
[docs]
class InvalidData(HarmonizeException):
"""
Represents an invalid data error. Throws when data is not valid.
"""
[docs]
class InvalidSession(HarmonizeException):
"""
Represents an invalid session error. Throws when session is not valid.
"""
[docs]
class RequestError(HarmonizeException):
"""
Represents a request error. Throws when the request fails.
"""
[docs]
class InvalidChannelStateException(HarmonizeException):
"""
Represents an invalid channel state error. Throws when trying to move a player without a valid guild or channel.
"""