fix(download): 下载失败时补全日志,避免卡在"正在获取 Metalink"突兀退出

- 主进程 Metalink 下载请求失败显式 sendLog 并回传渲染端(原仅静默 logger.error)
- aria2c 拉起失败补 sendLog 日志
- Metalink 写入完成补 sendLog 提示
- 渲染端 install-complete 失败分支将错误原因写入 logs,并补成功/失败终止日志
- 配套: 缓存修复(C1 主进程 no-cache + C2 axios ?_t 版本戳) 已在上一提交实现
- 文档 docs/app-list-cache-analysis.md 新增第8节下载日志断层修复方案
This commit is contained in:
xiyidaiwa
2026-08-11 18:50:31 +08:00
parent e0e6c50b89
commit 7cafcc51f6
3 changed files with 266 additions and 7 deletions
+10
View File
@@ -221,8 +221,18 @@ window.ipcRenderer.on("install-complete", (_event, log: DownloadResult) => {
if (downloadObj) {
if (log.success) {
downloadObj.status = "completed";
downloadObj.logs.push({ time: Date.now(), message: "下载完成" });
} else {
downloadObj.status = "failed";
// 将失败原因写入日志,避免 UI 停在"正在获取 Metalink"等中间日志后突兀结束
let reason = "未知错误";
try {
const parsed = JSON.parse(log.message);
reason = parsed?.message || reason;
} catch {
reason = log.message || reason;
}
downloadObj.logs.push({ time: Date.now(), message: `下载失败: ${reason}` });
}
}
});