fix: add error handling for unhandled promise rejections (#992)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
058f682f67
commit
6b3572c858
4 changed files with 13 additions and 3 deletions
|
|
@ -125,6 +125,10 @@ export class BgManagerOverlay {
|
|||
restartProcess(proc.id).then(() => {
|
||||
this.invalidate();
|
||||
this.tui.requestRender();
|
||||
}).catch((err) => {
|
||||
if (process.env.GSD_DEBUG) console.error('[bg-shell] restart failed:', err);
|
||||
this.invalidate();
|
||||
this.tui.requestRender();
|
||||
});
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,9 @@ export async function closeoutUnit(
|
|||
const { buildMemoryLLMCall, extractMemoriesFromUnit } = await import('./memory-extractor.js');
|
||||
const llmCallFn = buildMemoryLLMCall(ctx);
|
||||
if (llmCallFn) {
|
||||
extractMemoriesFromUnit(activityFile, unitType, unitId, llmCallFn).catch(() => {});
|
||||
extractMemoriesFromUnit(activityFile, unitType, unitId, llmCallFn).catch((err) => {
|
||||
if (process.env.GSD_DEBUG) console.error(`[gsd] memory extraction failed for ${unitType}/${unitId}:`, err);
|
||||
});
|
||||
}
|
||||
} catch { /* non-fatal */ }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -716,7 +716,9 @@ export async function saveFile(path: string, content: string): Promise<void> {
|
|||
await fs.rename(tmpPath, path);
|
||||
} catch (err) {
|
||||
// Clean up orphaned temp file on rename failure
|
||||
await fs.unlink(tmpPath).catch(() => {});
|
||||
await fs.unlink(tmpPath).catch((unlinkErr) => {
|
||||
if (process.env.GSD_DEBUG) console.error(`[gsd] temp file cleanup failed for ${tmpPath}:`, unlinkErr);
|
||||
});
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import { detectProjectState } from "./detection.js";
|
|||
import { showProjectInit, offerMigration } from "./init-wizard.js";
|
||||
import { showConfirm } from "../shared/confirm-ui.js";
|
||||
import { loadQueueOrder, sortByQueueOrder, saveQueueOrder } from "./queue-order.js";
|
||||
import { debugLog } from "./debug-logger.js";
|
||||
|
||||
// ─── Commit Instruction Helpers ──────────────────────────────────────────────
|
||||
|
||||
|
|
@ -148,8 +149,9 @@ export function checkAutoStartAfterDiscuss(): boolean {
|
|||
|
||||
pendingAutoStart = null;
|
||||
startAuto(ctx, pi, basePath, false, { step }).catch((err) => {
|
||||
ctx.ui.notify(`Auto-start failed: ${err instanceof Error ? err.message : String(err)}`, "warning");
|
||||
ctx.ui.notify(`Auto-start failed: ${err instanceof Error ? err.message : String(err)}`, "error");
|
||||
if (process.env.GSD_DEBUG) console.error('[gsd] auto start error:', err);
|
||||
debugLog("auto-start-failed", { error: err instanceof Error ? err.message : String(err) });
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue