mbishu's picture
Initialize SDK and fix vector store issues
a475b1f
Raw History Blame Contribute Delete
1.85 kB
"""
Custom exceptions for the Image Search SDK.
"""
class ImageSearchError(Exception):
"""Base exception for all Image Search SDK errors."""
pass
class AuthenticationError(ImageSearchError):
"""Raised when authentication fails."""
def __init__(self, message: str = "Authentication failed"):
super().__init__(message)
class RateLimitError(ImageSearchError):
"""Raised when rate limit is exceeded."""
def __init__(self, message: str = "Rate limit exceeded", retry_after: int = 60):
super().__init__(message)
self.retry_after = retry_after
class ConnectionError(ImageSearchError):
"""Raised when connection to the service fails."""
def __init__(self, message: str = "Connection failed"):
super().__init__(message)
class ValidationError(ImageSearchError):
"""Raised when input validation fails."""
def __init__(self, message: str = "Validation failed", field: str = None):
super().__init__(message)
self.field = field
class IndexingError(ImageSearchError):
"""Raised when product indexing fails."""
def __init__(self, message: str = "Indexing failed", product_id: str = None):
super().__init__(message)
self.product_id = product_id
class SearchError(ImageSearchError):
"""Raised when search operation fails."""
def __init__(self, message: str = "Search failed"):
super().__init__(message)
class DatabaseError(ImageSearchError):
"""Raised when database operations fail."""
def __init__(self, message: str = "Database operation failed"):
super().__init__(message)
class ConfigurationError(ImageSearchError):
"""Raised when configuration is invalid."""
def __init__(self, message: str = "Configuration error"):
super().__init__(message)