Log uncaught errors / promise rejections in main process

See #2019.
This commit is contained in:
Daniel Gasienica 2018-03-05 14:55:54 -05:00
parent 9e5fec1d81
commit 18785be639

11
main.js
View file

@ -1,3 +1,4 @@
const addUnhandledErrorHandler = require('electron-unhandled');
const path = require('path');
const url = require('url');
const os = require('os');
@ -22,6 +23,16 @@ const logging = require('./app/logging');
const windowState = require('./app/window_state');
const { createTemplate } = require('./app/menu');
addUnhandledErrorHandler({
logger: (error) => {
console.log(
'main.js: Uncaught error or unhandled promise rejection:',
error && error.stack ? error.stack : error
);
},
showDialog: false,
});
const appUserModelId = `org.whispersystems.${packageJson.name}`;
console.log('Set Windows Application User Model ID (AUMID)', { appUserModelId });
app.setAppUserModelId(appUserModelId);