1
0
mirror of https://github.com/rhysd/Mstdn.git synced 2025-01-21 20:52:11 +01:00

show app crash with dialog and die

This commit is contained in:
rhysd 2017-04-20 10:48:29 +09:00
parent d2315a576b
commit 0f449b8b2b

View File

@ -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<void>(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', () => {