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:
parent
d2315a576b
commit
0f449b8b2b
@ -1,4 +1,4 @@
|
|||||||
import {app} from 'electron';
|
import {app, dialog} from 'electron';
|
||||||
import log from './log';
|
import log from './log';
|
||||||
import startApp from './app';
|
import startApp from './app';
|
||||||
import loadConfig from './config';
|
import loadConfig from './config';
|
||||||
@ -10,7 +10,17 @@ app.removeAllListeners();
|
|||||||
const appReady = new Promise<void>(resolve => app.once('ready', resolve));
|
const appReady = new Promise<void>(resolve => app.once('ready', resolve));
|
||||||
|
|
||||||
process.on('unhandledRejection', (reason: string) => {
|
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', () => {
|
app.on('will-quit', () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user