Files
ProxyPool/app/core/exceptions.py
祀梦 38bd66128b 重构: 迁移后端代码到 app 目录,前端移动到 WebUI,添加完整测试套件
主要变更:
- 后端代码从根目录迁移到 app/ 目录
- 前端代码从 frontend/ 重命名为 WebUI/
- 更新所有导入路径以适配新结构
- 提取公共 API 响应函数到 app/api/common.py
- 精简验证器服务代码
- 更新启动脚本和文档

测试:
- 新增完整测试套件 (tests/)
- 单元测试: 模型、仓库层
- 集成测试: 覆盖所有 22+ API 端点
- E2E 测试: 4个完整工作流场景
- 添加 pytest 配置和测试运行脚本
2026-04-04 13:32:36 +08:00

25 lines
685 B
Python

"""业务异常定义"""
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)