From 80ac9f98347cdba559520428e44d500c7e650cb5 Mon Sep 17 00:00:00 2001 From: WangDL Date: Sun, 24 May 2026 12:38:30 +0800 Subject: [PATCH] fix: add global uncaught exception handlers to capture startup crashes Co-Authored-By: Claude Opus 4.7 --- src/main.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index ed14af0..52336c3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -97,4 +97,19 @@ async function bootstrap() { await app.listen(port); console.log(`[API] Server running on http://localhost:${port}`); } -bootstrap(); +// Startup Crash Diagnostics +process.on('uncaughtException', (err) => { + console.error('[FATAL] Uncaught Exception:', err.message); + console.error(err.stack); + process.exit(1); +}); +process.on('unhandledRejection', (reason) => { + console.error('[FATAL] Unhandled Rejection:', reason); + process.exit(1); +}); + +bootstrap().catch((err) => { + console.error('[FATAL] Bootstrap failed:', err.message); + console.error(err.stack); + process.exit(1); +});