EnkaNetwork.py icon indicating copy to clipboard operation
EnkaNetwork.py copied to clipboard

Add Base Class for Handling EnkaNetwork Errors

Open luoshuijs opened this issue 1 year ago • 2 comments

Our hope is to create a base class that can gracefully catch exceptions thrown from the EnkaNetwork.py module

class EnkaNetworError(Exception):
    """Base class for EnkaNetwork errors."""


class NetworkError(EnkaNetworError):
    """Base class for exceptions due to networking errors."""


class TimedOut(NetworkError):
    """Raised when a request took too long to finish."""


class BadRequest(EnkaNetworError):
    """Raised when EnkaNetwork could not process the request correctly."""


class EnkaValidateFailed(BadRequest):
    """Exception that's raised for when status code 400 occurs."""


...

luoshuijs avatar Feb 08 '23 13:02 luoshuijs