[docs]
class ApiTokenMissingError(Exception):
"""Raised when API key is not provided."""
pass
[docs]
class BaseUrlMissingError(Exception):
"""Raised when base url is not provided."""
pass
[docs]
class BadRequestsError(Exception):
"""Raised when a bad request is made"""
pass
[docs]
class UnauthorizedError(Exception):
"""Raised when an unauthorized request is made"""
pass
[docs]
class ForbiddenError(Exception):
"""Raised when a forbidden request is made"""
pass
[docs]
class TooManyRequestsError(Exception):
"""Raised when too many requests are made"""
pass
[docs]
class InternalServerError(Exception):
"""Raised when an internal server error occurs"""
pass
[docs]
class SportMonksAPIError(Exception):
"""Raised when SportMonks returns an API error."""
pass
[docs]
class IncompatibleDictionarySchema(Exception):
"""Raised when a dictionary cannot be unnested."""
pass
[docs]
class InvalidTimezoneError(Exception):
"""Raised when an unrecognized or invalid timezone is provided"""
pass
[docs]
class ParameterException(Exception):
"""Raised when an incorrect parameter type is provided"""
pass
[docs]
class ParameterLengthException(Exception):
"""Raised when the number of parameters requested in a single API call exceeds the allow amount"""
pass
[docs]
class InvalidIncludes(Exception):
"""Raised when an invalid object is passed as an includes argument"""
pass
status_code_to_exception = {
400: BadRequestsError("Bad request."),
401: UnauthorizedError("Unauthorized request."),
403: ForbiddenError("Forbidden request."),
429: TooManyRequestsError("Too many requests, please try again later."),
500: InternalServerError("Internal server error."),
}