mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-07-12 16:11:34 +08:00
refactor(backend): 重构后端异常处理和模型管理
- 新增自定义异常类 BizException、NoteError 和 ProviderError - 优化了模型管理相关的逻辑,包括加载、删除和测试连接等功能 - 改进了 Douyin 下载器的错误处理 - 调整了任务重试逻辑和笔记生成的异常处理- 更新了相关组件和页面以适应新的异常处理机制
This commit is contained in:
21
backend/app/enmus/exception.py
Normal file
21
backend/app/enmus/exception.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import enum
|
||||
|
||||
|
||||
class ProviderErrorEnum(enum.Enum):
|
||||
CONNECTION_TEST_FAILED = (200101, "供应商连接测试失败")
|
||||
SAVE_FAILED = (200102, "供应商保存失败")
|
||||
CREATE_FAILED = (200103, "供应商创建失败")
|
||||
NOT_FOUND = (200104, "供应商不存在/未保存")
|
||||
WRONG_PARAMETER = (200105, "API / API 地址不正确")
|
||||
UNKNOW_ERROR = (200106, "未知错误")
|
||||
|
||||
def __init__(self, code, message):
|
||||
self.code = code
|
||||
self.message = message
|
||||
|
||||
class NoteErrorEnum(enum.Enum):
|
||||
PLATFORM_NOT_SUPPORTED = (300101 ,"选择的平台不受支持")
|
||||
|
||||
def __init__(self, code, message):
|
||||
self.code = code
|
||||
self.message = message
|
||||
Reference in New Issue
Block a user