继续收敛错误报告读取正文
保留错误事件与诊断日志读取失败的具体原因 保留快照回退并更新错误报告回归测试
This commit is contained in:
@@ -68,19 +68,21 @@ export function ErrorReportDialog({
|
||||
);
|
||||
setEventsReady(true);
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((error) => {
|
||||
if (disposed) return;
|
||||
const detail = visibleClientErrorMessage(error);
|
||||
if (fallbackEvents.length) {
|
||||
setEvents(fallbackEvents);
|
||||
setSelectedFingerprints(
|
||||
new Set(fallbackEvents.map((event) => event.fingerprint)),
|
||||
);
|
||||
setEventsReady(true);
|
||||
setStatus('最新错误读取失败,已使用打开通知时的快照');
|
||||
setStatus(`最新错误读取失败:${detail};已使用打开通知时的快照`);
|
||||
return;
|
||||
}
|
||||
setEventsError(true);
|
||||
setEventsReady(true);
|
||||
setStatus(`错误事件读取失败:${detail}`);
|
||||
});
|
||||
void readApplicationDiagnosticLogs()
|
||||
.then((nextLogs) => {
|
||||
@@ -88,11 +90,16 @@ export function ErrorReportDialog({
|
||||
setLogs(nextLogs);
|
||||
setLogsReady(true);
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((error) => {
|
||||
if (disposed) return;
|
||||
setLogs([]);
|
||||
setLogsError(true);
|
||||
setLogsReady(true);
|
||||
setStatus((current) =>
|
||||
current
|
||||
? `${current};应用诊断日志读取失败:${visibleClientErrorMessage(error)}`
|
||||
: `应用诊断日志读取失败:${visibleClientErrorMessage(error)}`,
|
||||
);
|
||||
});
|
||||
return () => {
|
||||
disposed = true;
|
||||
|
||||
@@ -14,6 +14,8 @@ vi.mock('../src/services/errorReporting', () => ({
|
||||
getPendingClientErrorEvents: mockState.getPending,
|
||||
readApplicationDiagnosticLogs: mockState.readLogs,
|
||||
submitErrorReportBatch: vi.fn(),
|
||||
visibleClientErrorMessage: (error: unknown) =>
|
||||
error instanceof Error ? error.message : String(error),
|
||||
}));
|
||||
|
||||
vi.mock('../src/components/modal/ThemedModal', () => ({
|
||||
@@ -58,9 +60,7 @@ describe('ErrorReportDialog', () => {
|
||||
|
||||
render(<ErrorReportDialog open onClose={vi.fn()} />);
|
||||
|
||||
expect(
|
||||
await screen.findByText('错误事件暂不可用,请关闭后重试。'),
|
||||
).toBeTruthy();
|
||||
expect(await screen.findByText('错误事件读取失败:读取失败')).toBeTruthy();
|
||||
expect(screen.queryByText('当前没有待报告的错误。')).toBeNull();
|
||||
});
|
||||
|
||||
@@ -74,7 +74,9 @@ describe('ErrorReportDialog', () => {
|
||||
|
||||
expect(await screen.findByText(event.message)).toBeTruthy();
|
||||
expect(
|
||||
screen.getByText('最新错误读取失败,已使用打开通知时的快照'),
|
||||
screen.getByText(
|
||||
'最新错误读取失败:瞬时读取失败;已使用打开通知时的快照',
|
||||
),
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -81,3 +81,4 @@ DirectProject 回合失败在确认不是客户端内部不可归类故障时,
|
||||
- 策划 Agent 的 Tauri 事件订阅失败原先只放行回合等待、没有任何用户提示;现把订阅 IPC 正文写入项目聊天错误出口,避免只收到不完整的最终态。
|
||||
- 专业 Agent 历史回读与项目清单同步的后台 Promise 失败原先只返回 `failed` 或静默结束;现把具体读取/同步正文写入项目聊天错误出口。
|
||||
- Direct 交付计划/合同 JSON 解析、策划工作区目录枚举与文本搜索还有 `map_err(|_|)` / `Err(_)` 丢细节;现保留 serde、目录和文件读取正文,安全路径边界仍单独拒绝。
|
||||
- 错误报告对话框读取最新错误事件或诊断日志失败时原先只显示“暂不可用/使用快照”;现把读取 IPC/文件正文附在状态提示中,快照回退行为保持不变。
|
||||
|
||||
Reference in New Issue
Block a user