mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-06-13 03:30:10 +08:00
refactor(backend): 重构后端异常处理和模型管理
- 新增自定义异常类 BizException、NoteError 和 ProviderError - 优化了模型管理相关的逻辑,包括加载、删除和测试连接等功能 - 改进了 Douyin 下载器的错误处理 - 调整了任务重试逻辑和笔记生成的异常处理- 更新了相关组件和页面以适应新的异常处理机制
This commit is contained in:
@@ -36,7 +36,7 @@ const DownloaderForm = () => {
|
||||
setLoading(true) // 🔁 切换平台时显示 loading
|
||||
try {
|
||||
const res = await getDownloaderCookie(id)
|
||||
const cookie = res?.data?.data?.cookie || ''
|
||||
const cookie = res?.cookie || ''
|
||||
form.reset({ cookie }) // ✅ 正确重置表单值
|
||||
} catch (e) {
|
||||
toast.error('加载 Cookie 失败: ' + e)
|
||||
|
||||
@@ -129,11 +129,10 @@ const ProviderForm = ({ isCreate = false }: { isCreate?: boolean }) => {
|
||||
|
||||
try {
|
||||
const res = await deleteModelById(modelId)
|
||||
if (res.data.code === 0) {
|
||||
toast.success('删除成功')
|
||||
} else {
|
||||
toast.error(res.data.msg || '删除失败')
|
||||
}
|
||||
console.log('🔧 删除结果:', res)
|
||||
|
||||
toast.success('删除成功')
|
||||
|
||||
} catch (e) {
|
||||
toast.error('删除异常')
|
||||
}
|
||||
@@ -151,16 +150,16 @@ const ProviderForm = ({ isCreate = false }: { isCreate?: boolean }) => {
|
||||
return
|
||||
}
|
||||
setTesting(true)
|
||||
const data = await testConnection({
|
||||
id
|
||||
})
|
||||
if (data.data.code === 0) {
|
||||
await testConnection({
|
||||
id
|
||||
})
|
||||
|
||||
toast.success('测试连通性成功 🎉')
|
||||
} else {
|
||||
toast.error(`连接失败: ${data.data.msg || '未知错误'}`)
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
toast.error('测试连通性异常')
|
||||
|
||||
toast.error(`连接失败: ${data.data.msg || '未知错误'}`)
|
||||
// toast.error('测试连通性异常')
|
||||
} finally {
|
||||
setTesting(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user