Skip to content

Errors

Exceptions raised when an error is encountered during API calls.

AccessError

Bases: Exception

A class denoting an exception raised when required permission is not satisfied.

Attributes

required : str The required permission for a path route.

Source code in ravyapi/api/errors.py
class AccessError(Exception):
    """A class denoting an exception raised when required permission is not satisfied.

    Attributes
    ----------
    required : str
        The required permission for a path route.
    """

    __slots__: tuple[str, ...] = ("_required",)

    def __init__(self, required: str) -> None:
        """
        Parameters
        ----------
        required : str
            The permission that was needed.
        """
        super().__init__()
        self._required: str = required

    def __str__(self) -> str:
        return (
            f'Insufficient permissions accessing path route requiring "{self.required}"'
        )

    @property
    def required(self) -> str:
        """The required permission for a path route."""
        return self._required

required: str property

The required permission for a path route.

__init__(required)

Parameters

required : str The permission that was needed.

Source code in ravyapi/api/errors.py
def __init__(self, required: str) -> None:
    """
    Parameters
    ----------
    required : str
        The permission that was needed.
    """
    super().__init__()
    self._required: str = required

BadRequestError

Bases: HTTPError

A class denoting an exception raised when a bad request is made.

Attributes

exc_data : str | dict[str, Any] The error data returned by the Ravy API.

Source code in ravyapi/api/errors.py
class BadRequestError(HTTPError):
    """A class denoting an exception raised when a bad request is made.

    Attributes
    ----------
    exc_data : str | dict[str, Any]
        The error data returned by the Ravy API.
    """

    __slots__: tuple[str, ...] = ("_exc_data",)

    def __init__(self, exc_data: str | dict[str, Any]) -> None:
        """
        Parameters
        ----------
        exc_data : str | dict[str, Any]
            The error data returned by the Ravy API.
        """
        super().__init__(400, exc_data)

__init__(exc_data)

Parameters

exc_data : str | dict[str, Any] The error data returned by the Ravy API.

Source code in ravyapi/api/errors.py
def __init__(self, exc_data: str | dict[str, Any]) -> None:
    """
    Parameters
    ----------
    exc_data : str | dict[str, Any]
        The error data returned by the Ravy API.
    """
    super().__init__(400, exc_data)

ForbiddenError

Bases: HTTPError

A class denoting an exception raised when a forbidden request is made.

Attributes

exc_data : str | dict[str, Any] The error data returned by the Ravy API.

Source code in ravyapi/api/errors.py
class ForbiddenError(HTTPError):
    """A class denoting an exception raised when a forbidden request is made.

    Attributes
    ----------
    exc_data : str | dict[str, Any]
        The error data returned by the Ravy API.
    """

    __slots__: tuple[str, ...] = ("_exc_data",)

    def __init__(self, exc_data: str | dict[str, Any]) -> None:
        """
        Parameters
        ----------
        exc_data : str | dict[str, Any]
            The error data returned by the Ravy API.
        """
        super().__init__(403, exc_data)

__init__(exc_data)

Parameters

exc_data : str | dict[str, Any] The error data returned by the Ravy API.

Source code in ravyapi/api/errors.py
def __init__(self, exc_data: str | dict[str, Any]) -> None:
    """
    Parameters
    ----------
    exc_data : str | dict[str, Any]
        The error data returned by the Ravy API.
    """
    super().__init__(403, exc_data)

HTTPError

Bases: Exception

A base class for all HTTP exceptions.

Parameters

status : int The HTTP status code of the response. exc_data : str | dict[str, Any] The error data returned by the Ravy API.

Attributes

status : int The HTTP status code of the response. exc_data : str | dict[str, Any] The error data returned by the Ravy API.

Source code in ravyapi/api/errors.py
class HTTPError(Exception):
    """A base class for all HTTP exceptions.

    Parameters
    ----------
    status : int
        The HTTP status code of the response.
    exc_data : str | dict[str, Any]
        The error data returned by the Ravy API.

    Attributes
    ----------
    status : int
        The HTTP status code of the response.
    exc_data : str | dict[str, Any]
        The error data returned by the Ravy API.
    """

    __slots__: tuple[str, ...] = ("_status", "_exc_data")

    def __init__(self, status: int, exc_data: str | dict[str, Any]) -> None:
        """
        Parameters
        ----------
        status : int
            The HTTP status code of the response.
        exc_data : str | dict[str, Any]
            The error data returned by the Ravy API.
        """
        super().__init__()
        self._status: int = status
        self._exc_data: str | dict[str, Any] = exc_data

    def __str__(self) -> str:
        if isinstance(self.exc_data, dict):
            return (
                f"({self.status}) {self.exc_data['error']}"
                f" - {self.exc_data['details']}"
            )

        return f"({self.status}) {self.exc_data}"

    @property
    def status(self) -> int:
        """The HTTP status code of the response."""
        return self._status

    @property
    def exc_data(self) -> str | dict[str, Any]:
        """The error data returned by the Ravy API."""
        return self._exc_data

exc_data: str | dict[str, Any] property

The error data returned by the Ravy API.

status: int property

The HTTP status code of the response.

__init__(status, exc_data)

Parameters

status : int The HTTP status code of the response. exc_data : str | dict[str, Any] The error data returned by the Ravy API.

Source code in ravyapi/api/errors.py
def __init__(self, status: int, exc_data: str | dict[str, Any]) -> None:
    """
    Parameters
    ----------
    status : int
        The HTTP status code of the response.
    exc_data : str | dict[str, Any]
        The error data returned by the Ravy API.
    """
    super().__init__()
    self._status: int = status
    self._exc_data: str | dict[str, Any] = exc_data

NotFoundError

Bases: HTTPError

A class denoting an exception raised when a resource is not found.

Attributes

exc_data : str | dict[str, Any] The error data returned by the Ravy API.

Source code in ravyapi/api/errors.py
class NotFoundError(HTTPError):
    """A class denoting an exception raised when a resource is not found.

    Attributes
    ----------
    exc_data : str | dict[str, Any]
        The error data returned by the Ravy API.
    """

    __slots__: tuple[str, ...] = ("_exc_data",)

    def __init__(self, exc_data: str | dict[str, Any]) -> None:
        """
        Parameters
        ----------
        exc_data : str | dict[str, Any]
            The error data returned by the Ravy API.
        """
        super().__init__(404, exc_data)

__init__(exc_data)

Parameters

exc_data : str | dict[str, Any] The error data returned by the Ravy API.

Source code in ravyapi/api/errors.py
def __init__(self, exc_data: str | dict[str, Any]) -> None:
    """
    Parameters
    ----------
    exc_data : str | dict[str, Any]
        The error data returned by the Ravy API.
    """
    super().__init__(404, exc_data)

TooManyRequestsError

Bases: HTTPError

A class denoting an exception raised when a request is made too frequently.

Attributes

exc_data : str | dict[str, Any] The error data returned by the Ravy API.

Source code in ravyapi/api/errors.py
class TooManyRequestsError(HTTPError):
    """A class denoting an exception raised when a request is made too frequently.

    Attributes
    ----------
    exc_data : str | dict[str, Any]
        The error data returned by the Ravy API.
    """

    __slots__: tuple[str, ...] = ("_exc_data",)

    def __init__(self, exc_data: str | dict[str, Any]) -> None:
        """
        Parameters
        ----------
        exc_data : str | dict[str, Any]
            The error data returned by the Ravy API.
        """
        super().__init__(429, exc_data)

__init__(exc_data)

Parameters

exc_data : str | dict[str, Any] The error data returned by the Ravy API.

Source code in ravyapi/api/errors.py
def __init__(self, exc_data: str | dict[str, Any]) -> None:
    """
    Parameters
    ----------
    exc_data : str | dict[str, Any]
        The error data returned by the Ravy API.
    """
    super().__init__(429, exc_data)

UnauthorizedError

Bases: HTTPError

A class denoting an exception raised when an unauthorized request is made.

Attributes

exc_data : str | dict[str, Any] The error data returned by the Ravy API.

Source code in ravyapi/api/errors.py
class UnauthorizedError(HTTPError):
    """A class denoting an exception raised when an unauthorized request is made.

    Attributes
    ----------
    exc_data : str | dict[str, Any]
        The error data returned by the Ravy API.
    """

    __slots__: tuple[str, ...] = ("_exc_data",)

    def __init__(self, exc_data: str | dict[str, Any]) -> None:
        """
        Parameters
        ----------
        exc_data : str | dict[str, Any]
            The error data returned by the Ravy API.
        """
        super().__init__(401, exc_data)

__init__(exc_data)

Parameters

exc_data : str | dict[str, Any] The error data returned by the Ravy API.

Source code in ravyapi/api/errors.py
def __init__(self, exc_data: str | dict[str, Any]) -> None:
    """
    Parameters
    ----------
    exc_data : str | dict[str, Any]
        The error data returned by the Ravy API.
    """
    super().__init__(401, exc_data)