Skip to content

Documentation for sankaku's errors

sankaku.errors.SankakuError

Bases: Exception

Source code in sankaku/errors.py
class SankakuError(Exception):
    msg: str = ""

    def __init__(self, msg: Optional[str] = None) -> None:
        """Base error class for raising exceptions without any special params."""
        self.msg = msg or self.msg

    def __repr__(self) -> str:
        return repr(self.msg)

    def __str__(self) -> str:
        return str(self.msg)

__init__(msg=None)

Base error class for raising exceptions without any special params.

Source code in sankaku/errors.py
def __init__(self, msg: Optional[str] = None) -> None:
    """Base error class for raising exceptions without any special params."""
    self.msg = msg or self.msg

sankaku.errors.RateLimitError

Bases: SankakuError

Source code in sankaku/errors.py
class RateLimitError(SankakuError):
    msg = "Can't set both rps and rpm at once."

sankaku.errors.LoginRequirementError

Bases: SankakuError

Source code in sankaku/errors.py
class LoginRequirementError(SankakuError):
    msg = "You must be logged-in."

sankaku.errors.VideoDurationError

Bases: SankakuError

Source code in sankaku/errors.py
class VideoDurationError(SankakuError):
    msg = "Argument is available only with video files."

sankaku.errors.PaginatorLastPage

Bases: SankakuError

Source code in sankaku/errors.py
class PaginatorLastPage(SankakuError):  # noqa: N818
    msg = "Last available page reached."

sankaku.errors.SankakuServerError

Bases: SankakuError

Source code in sankaku/errors.py
class SankakuServerError(SankakuError):
    def __init__(
        self,
        status: Optional[int],
        msg: Optional[str] = None,
        **kwargs
    ) -> None:
        """Error class for parametrized exceptions."""
        self.status = status
        self.kwargs = kwargs

        str_kwargs = ", ".join(f"{k}={v}" for k, v in self.kwargs.items())
        delimiter = ": " if self.kwargs else ""
        self.msg = f"[{self.status}] {msg or self.msg}{delimiter}{str_kwargs}."

    def __repr__(self) -> str:
        return repr(self.msg)

    def __str__(self) -> str:
        return str(self.msg)

__init__(status, msg=None, **kwargs)

Error class for parametrized exceptions.

Source code in sankaku/errors.py
def __init__(
    self,
    status: Optional[int],
    msg: Optional[str] = None,
    **kwargs
) -> None:
    """Error class for parametrized exceptions."""
    self.status = status
    self.kwargs = kwargs

    str_kwargs = ", ".join(f"{k}={v}" for k, v in self.kwargs.items())
    delimiter = ": " if self.kwargs else ""
    self.msg = f"[{self.status}] {msg or self.msg}{delimiter}{str_kwargs}."

sankaku.errors.PageNotFoundError

Bases: SankakuServerError

Source code in sankaku/errors.py
class PageNotFoundError(SankakuServerError):
    msg = "Failed to fetch page with requested params"

sankaku.errors.AuthorizationError

Bases: SankakuServerError

Source code in sankaku/errors.py
class AuthorizationError(SankakuServerError):
    msg = "Authorization failed"