[ErrorHandler] Rewrite (1 export, no handled / init

mu
Oj 2 years ago
parent 2a82ee5a1c
commit 1ebdaa0b2b

6
src/bootstrap.js vendored

@ -14,8 +14,8 @@ global.releaseChannel = buildInfo.releaseChannel;
log('BuildInfo', buildInfo);
const { fatal, handled, init: EHInit } = require('./errorHandler');
EHInit();
const { fatal } = require('./errorHandler');
// process.on('uncaughtException', fatal);
const splash = require('./splash');
@ -69,7 +69,7 @@ const startUpdate = async () => {
inst.on('host-updated', () => autoStart.update(() => {}));
inst.on('unhandled-exception', fatal);
inst.on('InconsistentInstallerState', fatal);
inst.on('update-error', handled);
inst.on('update-error', console.error);
require('./firstRun').do(inst);
} else {

@ -1,25 +1,8 @@
const { app, dialog } = require("electron");
exports.init = () => {
process.on('uncaughtException', err => {
const stack = err.stack ?? String(err);
console.warn(stack);
// dialog.showErrorBox('A JavaScript error occurred in the main process', message);
});
};
exports.fatal = (err) => {
log('ErrorHandler', 'Fatal:', err);
dialog.showMessageBox(null, {
type: 'error',
message: 'A fatal Javascript error occured',
detail: err?.stack ?? String(err)
}).then(() => app.quit());
};
exports.handled = (err) => {
log('ErrorHandler', 'Handled:', err);
};
exports.fatal = (e) => dialog.showMessageBox({
type: 'error',
message: 'A fatal Javascript error occured',
detail: e?.stack ?? String(e)
}).then(() => app.quit());
Loading…
Cancel
Save