OpenAsar/src/errorHandler.js

25 lines
589 B
JavaScript
Raw Normal View History

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