fix: 增加错误处理日志以便调试同步和请求失败问题

This commit is contained in:
huojl 2026-06-01 15:27:33 +08:00
parent 99ae04dad6
commit fed8a18cb7
3 changed files with 5 additions and 1 deletions

Binary file not shown.

View file

@ -48,6 +48,7 @@ export class SonicNoteApiClient {
if (e?.json) {
return e.json as BackendResponse;
}
console.error(`[SonicNote] 请求失败 ${method} ${path}:`, e?.message || e);
throw new Error(e?.message || `请求失败: ${method} ${path}`);
}
}

View file

@ -46,6 +46,7 @@ export class SyncService {
} catch (e) {
const msg = e instanceof Error ? e.message : '获取录音列表失败';
result.errorMessages.push(msg);
console.error('[SonicNote] 获取录音列表失败:', e);
new Notice(`同步失败: ${msg}`);
return result;
}
@ -66,7 +67,9 @@ export class SyncService {
} catch (e) {
result.errors++;
const msg = e instanceof Error ? e.message : '未知错误';
result.errorMessages.push(`${recording.recordNickName || recording.recordName}: ${msg}`);
const name = recording.recordNickName || recording.recordName;
result.errorMessages.push(`${name}: ${msg}`);
console.error(`[SonicNote] 同步失败 — ${name} (${recording.audioId}):`, e);
}
}