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