[ErrorHandler] Rewrite to fix and be simpler
This commit is contained in:
parent
2027d7226d
commit
21256d5da2
1 changed files with 2 additions and 10 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue