2024-11-15 09:51:11 -05:00
|
|
|
class ResponseError(Exception):
|
|
|
|
"""Raised when an API response is empty or has an unexpected format"""
|
|
|
|
|
|
|
|
def __init__(self, message) -> None:
|
|
|
|
self.message = "Invalid response from Flowery API: " + message
|
|
|
|
|
|
|
|
|
2024-09-17 23:24:14 -04:00
|
|
|
class InternalServerError(Exception):
|
2024-09-17 23:31:50 -04:00
|
|
|
"""Raised when the API returns a 5xx status code"""
|
2024-11-15 09:51:11 -05:00
|
|
|
|
|
|
|
def __init__(self, message) -> None:
|
2024-09-17 23:24:14 -04:00
|
|
|
self.message = message
|
|
|
|
|
2024-11-15 09:51:11 -05:00
|
|
|
|
2024-09-17 23:24:14 -04:00
|
|
|
class ClientError(Exception):
|
2024-09-17 23:31:50 -04:00
|
|
|
"""Raised when the API returns a 4xx status code"""
|
2024-11-15 09:51:11 -05:00
|
|
|
|
|
|
|
def __init__(self, message) -> None:
|
2024-09-17 23:24:14 -04:00
|
|
|
self.message = message
|
|
|
|
|
2024-11-15 09:51:11 -05:00
|
|
|
|
2024-09-17 23:24:14 -04:00
|
|
|
class TooManyRequests(Exception):
|
2024-09-17 23:31:50 -04:00
|
|
|
"""Raised when the API returns a 429 status code"""
|
2024-11-15 09:51:11 -05:00
|
|
|
|
|
|
|
def __init__(self, message) -> None:
|
2024-09-17 23:24:14 -04:00
|
|
|
self.message = message
|
|
|
|
|
2024-11-15 09:51:11 -05:00
|
|
|
|
2024-09-17 23:24:14 -04:00
|
|
|
class RetryLimitExceeded(Exception):
|
2024-09-17 23:31:50 -04:00
|
|
|
"""Raised when the retry limit is exceeded"""
|
2024-11-15 09:51:11 -05:00
|
|
|
|
|
|
|
def __init__(self, message) -> None:
|
2024-09-17 23:24:14 -04:00
|
|
|
self.message = message
|