From 0f449b8b2b870f89f8d49a949b6e043579e7d7f4 Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 20 Apr 2017 10:48:29 +0900 Subject: [PATCH] show app crash with dialog and die --- main/index.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/main/index.ts b/main/index.ts index f1da477..787edb4 100644 --- a/main/index.ts +++ b/main/index.ts @@ -1,4 +1,4 @@ -import {app} from 'electron'; +import {app, dialog} from 'electron'; import log from './log'; import startApp from './app'; import loadConfig from './config'; @@ -10,7 +10,17 @@ app.removeAllListeners(); const appReady = new Promise(resolve => app.once('ready', resolve)); process.on('unhandledRejection', (reason: string) => { - log.error('FATAL: Unhandled rejection! Reason:', reason); + const msg = 'FATAL: Unhandled rejection! Reason: ' + reason + appReady.then(() => { + dialog.showMessageBox({ + type: 'error', + buttons: ['OK'], + message: msg, + }, () => { + qpp.quit(); + }) + }); + log.error(msg); }); app.on('will-quit', () => {