Extract Errors.addGlobalHandler procedure

This commit is contained in:
Daniel Gasienica 2018-03-06 12:05:53 -05:00
parent be3e4d86c2
commit 2575196617
2 changed files with 19 additions and 10 deletions

17
js/modules/errors.js Normal file
View file

@ -0,0 +1,17 @@
const addUnhandledErrorHandler = require('electron-unhandled');
const Errors = require('./types/errors');
// addGlobalHandler :: Unit -> Unit
exports.addGlobalHandler = () => {
addUnhandledErrorHandler({
logger: (error) => {
console.error(
'Uncaught error or unhandled promise rejection:',
Errors.toLogFormat(error)
);
},
showDialog: false,
});
};