Module ro_py.utilities.errors
ro.py > errors.py
This file houses custom exceptions unique to this module.
Expand source code
"""
ro.py > errors.py
This file houses custom exceptions unique to this module.
"""
# The following are HTTP generic errors used by utilities/requests.py
class ApiError(Exception):
"""Called in requests when an API request fails with an error code that doesn't have an independent error."""
pass
class BadRequest(ApiError):
"""400 HTTP error"""
pass
class Unauthorized(ApiError):
"""401 HTTP error"""
pass
class Forbidden(ApiError):
"""403 HTTP error"""
pass
class NotFound(ApiError):
"""404 HTTP error (also used for other things)"""
pass
class Conflict(ApiError):
"""409 HTTP error"""
pass
class TooManyRequests(ApiError):
"""429 HTTP error"""
pass
class InternalServerError(ApiError):
"""500 HTTP error"""
pass
class BadGateway(ApiError):
"""502 HTTP error"""
pass
# The following errors are specific to certain parts of ro.py
class NotLimitedError(Exception):
"""Called when code attempts to read limited-only information."""
pass
class InvalidIconSizeError(Exception):
"""Called when code attempts to pass in an improper size to a thumbnail function."""
pass
class InvalidShotTypeError(Exception):
"""Called when code attempts to pass in an improper avatar image type to a thumbnail function."""
pass
class ChatError(Exception):
"""Called in chat when a chat action fails."""
class InvalidPageError(Exception):
"""Called when an invalid page is requested."""
class UserDoesNotExistError(Exception):
"""Called when a user does not exist."""
class GameJoinError(Exception):
"""Called when an error occurs when joining a game."""
class InvalidPlaceIDError(Exception):
"""Called when place ID is invalid."""
class IncorrectKeyError(Exception):
"""Raised when the api key for 2captcha is incorrect."""
pass
class InsufficientCreditError(Exception):
"""Raised when there is insufficient credit in 2captcha."""
pass
class NoAvailableWorkersError(Exception):
"""Raised when there are no available workers."""
pass
c_errors = {
"400": BadRequest,
"401": Unauthorized,
"403": Forbidden,
"404": NotFound,
"409": Conflict,
"429": TooManyRequests,
"500": InternalServerError,
"502": BadGateway
}
Classes
class ApiError (*args, **kwargs)
-
Called in requests when an API request fails with an error code that doesn't have an independent error.
Expand source code
class ApiError(Exception): """Called in requests when an API request fails with an error code that doesn't have an independent error.""" pass
Ancestors
- builtins.Exception
- builtins.BaseException
Subclasses
class BadGateway (*args, **kwargs)
-
502 HTTP error
Expand source code
class BadGateway(ApiError): """502 HTTP error""" pass
Ancestors
- ApiError
- builtins.Exception
- builtins.BaseException
class BadRequest (*args, **kwargs)
-
400 HTTP error
Expand source code
class BadRequest(ApiError): """400 HTTP error""" pass
Ancestors
- ApiError
- builtins.Exception
- builtins.BaseException
class ChatError (*args, **kwargs)
-
Called in chat when a chat action fails.
Expand source code
class ChatError(Exception): """Called in chat when a chat action fails."""
Ancestors
- builtins.Exception
- builtins.BaseException
class Conflict (*args, **kwargs)
-
409 HTTP error
Expand source code
class Conflict(ApiError): """409 HTTP error""" pass
Ancestors
- ApiError
- builtins.Exception
- builtins.BaseException
class Forbidden (*args, **kwargs)
-
403 HTTP error
Expand source code
class Forbidden(ApiError): """403 HTTP error""" pass
Ancestors
- ApiError
- builtins.Exception
- builtins.BaseException
class GameJoinError (*args, **kwargs)
-
Called when an error occurs when joining a game.
Expand source code
class GameJoinError(Exception): """Called when an error occurs when joining a game."""
Ancestors
- builtins.Exception
- builtins.BaseException
class IncorrectKeyError (*args, **kwargs)
-
Raised when the api key for 2captcha is incorrect.
Expand source code
class IncorrectKeyError(Exception): """Raised when the api key for 2captcha is incorrect.""" pass
Ancestors
- builtins.Exception
- builtins.BaseException
class InsufficientCreditError (*args, **kwargs)
-
Raised when there is insufficient credit in 2captcha.
Expand source code
class InsufficientCreditError(Exception): """Raised when there is insufficient credit in 2captcha.""" pass
Ancestors
- builtins.Exception
- builtins.BaseException
class InternalServerError (*args, **kwargs)
-
500 HTTP error
Expand source code
class InternalServerError(ApiError): """500 HTTP error""" pass
Ancestors
- ApiError
- builtins.Exception
- builtins.BaseException
class InvalidIconSizeError (*args, **kwargs)
-
Called when code attempts to pass in an improper size to a thumbnail function.
Expand source code
class InvalidIconSizeError(Exception): """Called when code attempts to pass in an improper size to a thumbnail function.""" pass
Ancestors
- builtins.Exception
- builtins.BaseException
class InvalidPageError (*args, **kwargs)
-
Called when an invalid page is requested.
Expand source code
class InvalidPageError(Exception): """Called when an invalid page is requested."""
Ancestors
- builtins.Exception
- builtins.BaseException
class InvalidPlaceIDError (*args, **kwargs)
-
Called when place ID is invalid.
Expand source code
class InvalidPlaceIDError(Exception): """Called when place ID is invalid."""
Ancestors
- builtins.Exception
- builtins.BaseException
class InvalidShotTypeError (*args, **kwargs)
-
Called when code attempts to pass in an improper avatar image type to a thumbnail function.
Expand source code
class InvalidShotTypeError(Exception): """Called when code attempts to pass in an improper avatar image type to a thumbnail function.""" pass
Ancestors
- builtins.Exception
- builtins.BaseException
class NoAvailableWorkersError (*args, **kwargs)
-
Raised when there are no available workers.
Expand source code
class NoAvailableWorkersError(Exception): """Raised when there are no available workers.""" pass
Ancestors
- builtins.Exception
- builtins.BaseException
class NotFound (*args, **kwargs)
-
404 HTTP error (also used for other things)
Expand source code
class NotFound(ApiError): """404 HTTP error (also used for other things)""" pass
Ancestors
- ApiError
- builtins.Exception
- builtins.BaseException
class NotLimitedError (*args, **kwargs)
-
Called when code attempts to read limited-only information.
Expand source code
class NotLimitedError(Exception): """Called when code attempts to read limited-only information.""" pass
Ancestors
- builtins.Exception
- builtins.BaseException
class TooManyRequests (*args, **kwargs)
-
429 HTTP error
Expand source code
class TooManyRequests(ApiError): """429 HTTP error""" pass
Ancestors
- ApiError
- builtins.Exception
- builtins.BaseException
-
401 HTTP error
Expand source code
class Unauthorized(ApiError): """401 HTTP error""" pass
Ancestors
- ApiError
- builtins.Exception
- builtins.BaseException
class UserDoesNotExistError (*args, **kwargs)
-
Called when a user does not exist.
Expand source code
class UserDoesNotExistError(Exception): """Called when a user does not exist."""
Ancestors
- builtins.Exception
- builtins.BaseException