Spaces:
Sleeping
Sleeping
File size: 1,432 Bytes
aa7a28b edbb770 aa7a28b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | class BaseAppException(Exception):
"""Base exception for all application-specific errors."""
def __init__(self, message: str, status_code: int = 400):
self.message = message
self.status_code = status_code
super().__init__(self.message)
class WorkspaceNotFoundError(BaseAppException):
"""Raised when a workspace or brand is not found."""
def __init__(self, message: str = "Workspace not found"):
super().__init__(message, status_code=404)
class DocumentNotFoundError(BaseAppException):
"""Raised when a document is not found."""
def __init__(self, message: str = "Document not found"):
super().__init__(message, status_code=404)
class ShopifyError(BaseAppException):
"""Base for Shopify-related errors."""
pass
class ShopifyTimeoutError(ShopifyError):
def __init__(self, message: str = "Shopify request timed out"):
super().__init__(message, status_code=504)
class ShopifyConnectionError(ShopifyError):
def __init__(self, message: str = "Could not connect to Shopify"):
super().__init__(message, status_code=502)
class RateLimitExceeded(BaseAppException):
def __init__(self, message: str = "Rate limit exceeded"):
super().__init__(message, status_code=429)
class InvalidRequestError(BaseAppException):
def __init__(self, message: str = "Invalid request"):
super().__init__(message, status_code=400)
|