From 4c9550b089aeda07153a2ba203c54d27b988e9ff Mon Sep 17 00:00:00 2001 From: sabonerune <102559104+sabonerune@users.noreply.github.com> Date: Tue, 14 May 2024 15:19:27 +0900 Subject: [PATCH] =?UTF-8?q?FIX:=20=E3=83=A1=E3=82=A4=E3=83=B3=E3=83=97?= =?UTF-8?q?=E3=83=AD=E3=82=BB=E3=82=B9=E3=81=A7=E6=9C=AA=E6=8D=95=E6=8D=89?= =?UTF-8?q?=E3=81=AE=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=8C=E7=99=BA=E7=94=9F?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=81=A8=E3=81=8D=E3=81=AE=E5=87=A6=E7=90=86?= =?UTF-8?q?=E3=82=92=E5=A4=89=E6=9B=B4=20(#2060)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * FIX: メインプロセスで未捕捉のエラーが発生したときの処理を変更 * Update src/backend/electron/main.ts --------- Co-authored-by: Hiroshiba --- src/backend/electron/main.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/backend/electron/main.ts b/src/backend/electron/main.ts index 915ceb9cad..1889dee3ec 100644 --- a/src/backend/electron/main.ts +++ b/src/backend/electron/main.ts @@ -114,6 +114,21 @@ let win: BrowserWindow; process.on("uncaughtException", (error) => { log.error(error); + + if (isDevelopment) { + app.exit(1); + } else { + const { message, name } = error; + let detailedMessage = ""; + detailedMessage += `メインプロセスで原因不明のエラーが発生しました。\n`; + detailedMessage += `エラー名: ${name}\n`; + detailedMessage += `メッセージ: ${message}\n`; + if (error.stack) { + detailedMessage += `スタックトレース: \n${error.stack}`; + } + + dialog.showErrorBox("エラー", detailedMessage); + } }); process.on("unhandledRejection", (reason) => { log.error(reason);