"""业务异常定义""" class ProxyPoolException(Exception): """基础业务异常""" def __init__(self, message: str, code: int = 500): self.message = message self.code = code super().__init__(self.message) class PluginNotFoundException(ProxyPoolException): def __init__(self, plugin_id: str): super().__init__(f"Plugin '{plugin_id}' not found", 404) class ProxyNotFoundException(ProxyPoolException): def __init__(self, ip: str, port: int): super().__init__(f"Proxy {ip}:{port} not found", 404) class ValidationException(ProxyPoolException): def __init__(self, message: str): super().__init__(message, 400)