Source code for novauniverse.api.errors
from ..errors import NovaError
# BASE EXCEPTION
#------------------
[docs]
class NovaAPIError(NovaError):
"""Error raised when a known error occurs on the API."""
def __init__(self, message:str) -> None:
super().__init__(message)
# Other exceptions.
#---------------------
[docs]
class NoEndpointPassed(NovaAPIError):
"""Raised when no endpoint is passed to NovaAPI."""
def __init__(self) -> None:
super().__init__("No endpoint was passed to NovaAPI(), an endpoint must be passed to use it's methods.")
[docs]
class FailedConnectivityCheck(NovaAPIError):
"""Raised when failed to connect to Nova Universe API."""
def __init__(self) -> None:
super().__init__("Failed to establish a connection with Nova Universe API. Failed connect check. The API is probably offline. Blame Anton.")
[docs]
class UnSuccessfulOperation(NovaAPIError):
"""Raised when Nova Universe API returns unsuccessful operation."""
def __init__(self, message_from_api) -> None:
super().__init__(f"That operation was returned as unsuccessful by the Nova Universe API.\n Error --> {message_from_api}")