2021-12-12 13:06:28 +00:00
|
|
|
const { app, dialog } = require("electron");
|
2021-12-09 16:25:14 +00:00
|
|
|
|
|
|
|
exports.init = () => {
|
2021-12-11 19:51:36 +00:00
|
|
|
process.on('uncaughtException', error => {
|
2021-12-09 16:25:14 +00:00
|
|
|
const stack = error.stack ? error.stack : String(error);
|
2021-12-11 19:51:36 +00:00
|
|
|
const message = `Uncaught exception:\n${stack}`;
|
2021-12-09 16:25:14 +00:00
|
|
|
console.warn(message);
|
|
|
|
|
2021-12-11 19:51:36 +00:00
|
|
|
// _electron.dialog.showErrorBox('A JavaScript error occurred in the main process', message);
|
|
|
|
});
|
|
|
|
|
|
|
|
log('ErrorHandler', 'Inited');
|
2021-12-09 16:25:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
exports.fatal = (err) => {
|
|
|
|
const options = {
|
|
|
|
type: 'error',
|
|
|
|
message: 'A fatal Javascript error occured',
|
|
|
|
detail: err && err.stack ? err.stack : String(err)
|
|
|
|
};
|
|
|
|
|
2021-12-12 13:06:28 +00:00
|
|
|
dialog.showMessageBox(null, options).then(() => app.quit());
|
2021-12-09 16:25:14 +00:00
|
|
|
|
|
|
|
log('ErrorHandler', 'Fatal:', err);
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.handled = (err) => {
|
|
|
|
log('ErrorHandler', 'Handled:', err);
|
|
|
|
};
|