exceptions.pyβ’1.4 kB
"""
Custom exceptions for MCP Stock Details Server
"""
class MCPStockDetailsError(Exception):
"""Base exception for MCP Stock Details Server"""
def __init__(self, message: str, error_code: str = None):
self.message = message
self.error_code = error_code
super().__init__(self.message)
class DataCollectionError(MCPStockDetailsError):
"""Exception raised during data collection from external sources"""
pass
class DataValidationError(MCPStockDetailsError):
"""Exception raised when data validation fails"""
pass
class DatabaseError(MCPStockDetailsError):
"""Exception raised for database operations"""
pass
class CacheError(MCPStockDetailsError):
"""Exception raised for cache operations"""
pass
class ConfigurationError(MCPStockDetailsError):
"""Exception raised for configuration issues"""
pass
class APIError(MCPStockDetailsError):
"""Exception raised for external API errors"""
def __init__(self, message: str, status_code: int = None, error_code: str = None):
self.status_code = status_code
super().__init__(message, error_code)
class CompanyNotFoundError(MCPStockDetailsError):
"""Exception raised when company is not found"""
pass
class InsufficientDataError(MCPStockDetailsError):
"""Exception raised when insufficient data is available for analysis"""
pass