Skip to content

Commit

Permalink
FIX: メインプロセスで未捕捉のエラーが発生したときの処理を変更 (#2060)
Browse files Browse the repository at this point in the history
* FIX: メインプロセスで未捕捉のエラーが発生したときの処理を変更

* Update src/backend/electron/main.ts

---------

Co-authored-by: Hiroshiba <[email protected]>
  • Loading branch information
sabonerune and Hiroshiba authored May 14, 2024
1 parent 595d108 commit 4c9550b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/backend/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4c9550b

Please sign in to comment.