diff --git a/locales/installer-pf/ko-kr.json b/locales/installer-pf/ko-kr.json index 6b2fa96..9471fce 100644 --- a/locales/installer-pf/ko-kr.json +++ b/locales/installer-pf/ko-kr.json @@ -58,6 +58,7 @@ "closeTry": "UPnP 매핑 제거 시도: TCP {{port}}", "upnpRemoveAttempt": "UPnP 매핑 제거 시도: {{message}}", "upnpRemoveDone": "UPnP 매핑 제거 완료: TCP {{port}}", + "internalError": "내부 오류(무시하고 계속): {{message}}", "upnpClientFail": "UPnP 클라이언트 생성 실패: {{message}}", "portInUse": "포트 {{port}}이(가) 이미 사용 중 → 임시 리스너 없이 외부 서비스 응답만으로 판정.", "listenerBindFail": "임시 리스너 바인딩 실패: {{message}}", diff --git a/package.json b/package.json index 1c70ec2..1950912 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minecraft-music-quiz-installer", - "version": "0.3.17", + "version": "0.3.18", "description": "마인크래프트 음악퀴즈 간편설치기 + 관리 사이트", "main": "dist/installer/main.js", "scripts": { diff --git a/src/installer-pf/main.ts b/src/installer-pf/main.ts index 6f4eada..36df5ee 100644 --- a/src/installer-pf/main.ts +++ b/src/installer-pf/main.ts @@ -38,6 +38,16 @@ function sendLog(line: string): void { mainWindow.webContents.send('log', stamped) } +// nat-upnp 는 라우터가 UPnP 를 거부/미지원할 때 콜백 밖에서 비동기 소켓 오류를 +// 낼 수 있다. 처리되지 않으면 Electron 메인 프로세스가 그대로 종료되어 창이 갑자기 +// 닫힌다("오류나면서 끝남"). 전역 가드로 잡아 로그만 남기고 앱은 계속 살려 둔다. +process.on('uncaughtException', (err) => { + try { sendLog(t('log.internalError', { message: (err as Error)?.message || String(err) })) } catch {} +}) +process.on('unhandledRejection', (reason) => { + try { sendLog(t('log.internalError', { message: reason instanceof Error ? reason.message : String(reason) })) } catch {} +}) + const sleep = (ms: number): Promise => new Promise((resolve) => setTimeout(resolve, ms)) /** 이 PC 의 LAN IPv4(사설 대역 우선). 수동 포워딩 대상 IP 안내에 쓴다. */