Skip to content

error

ArgumentError(message)

Bases: Exception

Error that gets raised if something is wrong with the arguments provided to a callable.

Parameters:

Name Type Description Default
message str

Failure reason

required
Source code in api/src/anipy_api/error.py
def __init__(self, message: str):
    """__init__ for ArgumentError

    Args:
        message: Failure reason
    """
    super().__init__(message)

BeautifulSoupLocationError(what, where)

Bases: Exception

Error that gets raised in the Provider if there are errors with parsing HTML content.

Parameters:

Name Type Description Default
what str

What could not be parsed

required
where str

The url of the to be parsed content

required
Source code in api/src/anipy_api/error.py
def __init__(self, what: str, where: str):
    """__init__ for BeautifulSoupLocationError.

    Args:
        what: What could not be parsed
        where: The url of the to be parsed content
    """
    super().__init__(f"Could not locate {what} at {where}")

DownloadError(message)

Bases: Exception

Error that gets raised by Downloader.

Parameters:

Name Type Description Default
message str

Failure reason

required
Source code in api/src/anipy_api/error.py
def __init__(self, message: str):
    """__init__ for DownloadError.

    Args:
        message: Failure reason
    """
    super().__init__(message)

LangTypeNotAvailableError(identifier, provider, lang)

Bases: Exception

Error that gets raised in the Provider if the specified language type is not available.

Parameters:

Name Type Description Default
identifier str

Identifier of the Anime

required
provider str

Name of the Provider

required
lang LanguageTypeEnum

The language that is not available

required
Source code in api/src/anipy_api/error.py
def __init__(self, identifier: str, provider: str, lang: "LanguageTypeEnum"):
    """__init__ for LangTypeNotAvailableError.

    Args:
        identifier: Identifier of the Anime
        provider: Name of the Provider
        lang: The language that is not available
    """
    super().__init__(
        f"{str(lang).capitalize()} is not available for identifier `{identifier}` on provider `{provider}`"
    )

MyAnimeListError(url, status, mal_api_error=None)

Bases: Exception

Error that gets raised by MyAnimeList, this may include authentication errors or other HTTP errors.

Parameters:

Name Type Description Default
url str

Requested URL that caused the error

required
status int

HTTP status code

required
mal_api_error Optional[Dict]

MyAnimeList api error if returned

None
Source code in api/src/anipy_api/error.py
def __init__(
    self, url: str, status: int, mal_api_error: Optional[Dict] = None
) -> None:
    """__init__ for MyAnimeListError.

    Args:
        url: Requested URL that caused the error
        status: HTTP status code
        mal_api_error: MyAnimeList api error if returned
    """
    error_text = f"Error requesting {url}, status is {status}."
    if mal_api_error:
        error_text = f"{error_text} Additional info from api {mal_api_error}"

    super().__init__(error_text)

PlayerError(message)

Bases: Exception

Error that gets throws by certain functions in the player module.

Parameters:

Name Type Description Default
message str

Failure reason

required
Source code in api/src/anipy_api/error.py
def __init__(self, message: str):
    """__init__ for PlayerError.

    Args:
        message: Failure reason
    """
    super().__init__(message)

ProviderNotAvailable(provider)

Bases: Exception

Error that gets raised if a requested provider is not available.

Parameters:

Name Type Description Default
provider str

Provider in question

required
Source code in api/src/anipy_api/error.py
def __init__(self, provider: str):
    """__init__ for ProviderNotAvailable

    Args:
        provider: Provider in question
    """
    super().__init__(f"Could not find provider '{provider}'")