[ErrorHandler] Rewrite to fix and be simpler

main
Oj 2 years ago
parent 2027d7226d
commit 21256d5da2

@ -1,4 +1,4 @@
const { app } = require("electron"); const { app, dialog } = require("electron");
exports.init = () => { exports.init = () => {
process.on('uncaughtException', error => { process.on('uncaughtException', error => {
@ -20,15 +20,7 @@ exports.fatal = (err) => {
detail: err && err.stack ? err.stack : String(err) detail: err && err.stack ? err.stack : String(err)
}; };
const callback = _ => app.quit(); dialog.showMessageBox(null, options).then(() => app.quit());
const electronMajor = parseInt(process.versions.electron.split('.')[0]);
if (electronMajor >= 6) {
_electron.dialog.showMessageBox(null, options).then(callback);
} else {
_electron.dialog.showMessageBox(options, callback);
}
log('ErrorHandler', 'Fatal:', err); log('ErrorHandler', 'Fatal:', err);
}; };

Loading…
Cancel
Save