PyFlowery/pyflowery/exceptions.py
cswimr a7113babb7
Some checks failed
Actions / Build (push) Successful in 18s
Actions / Lint with Ruff & Pylint (push) Failing after 15s
Actions / Build Documentation (push) Successful in 24s
(3.0.1) mypy compliance
2024-11-15 09:51:11 -05:00

33 lines
877 B
Python

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
class InternalServerError(Exception):
"""Raised when the API returns a 5xx status code"""
def __init__(self, message) -> None:
self.message = message
class ClientError(Exception):
"""Raised when the API returns a 4xx status code"""
def __init__(self, message) -> None:
self.message = message
class TooManyRequests(Exception):
"""Raised when the API returns a 429 status code"""
def __init__(self, message) -> None:
self.message = message
class RetryLimitExceeded(Exception):
"""Raised when the retry limit is exceeded"""
def __init__(self, message) -> None:
self.message = message