electron-17: refactored code related to crash reporter

This commit is contained in:
Vishwas Shashidhar 2017-09-19 11:56:11 +05:30
parent d4b30ba148
commit 08b58b51bb
4 changed files with 3 additions and 50 deletions

View File

@ -1,47 +0,0 @@
'use strict';
const {crashReporter} = require('electron');
let crashReporterDetails;
let crashDirectoryPath;
/**
* Setup the crash reporter with appropriate information
* from the global config file
* @param detailObj: An object to send extra parameters
* via the crash reporter
*/
function setupCrashReporter(detailObj) {
// App store builds cannot use crash reporter, so, exit if that's the case
if (process.platform === 'darwin' && process.mas) {
return
}
if (process.type === 'renderer' && !(process.platform === 'darwin')) {
return;
}
// If the crash reporter info is empty, exit
if (!crashReporterDetails){
return
}
let crashReportInfo = crashReporterDetails;
crashReportInfo.extra = detailObj;
crashReporter.start(crashReportInfo);
crashDirectoryPath = crashReporter.getCrashesDirectory();
}
function setCrashReporterDetails(crashReporterInfo) {
crashReporterDetails = crashReporterInfo;
}
function getCrashDirectoryPath() {
return crashDirectoryPath;
}
exports.setupCrashReporter = setupCrashReporter;
exports.setCrashReporterDetails = setCrashReporterDetails;
exports.getCrashDirectoryPath = getCrashDirectoryPath;

View File

@ -32,7 +32,7 @@ require('./memoryMonitor.js');
const windowMgr = require('./windowMgr.js');
crashReporter.start({companyName: 'Symphony', uploadToServer: false, submitURL: 'http://localhost:3000/', extra: {'process': 'main'}});
crashReporter.start({companyName: 'Symphony', uploadToServer: false, extra: {'process': 'main'}});
// only allow a single instance of app.
const shouldQuit = app.makeSingleInstance((argv) => {

View File

@ -53,7 +53,7 @@ const throttledSetBadgeCount = throttle(1000, function(count) {
});
});
crashReporter.start({companyName: 'Symphony', uploadToServer: false, submitURL: 'http://localhost:3000/', extra: {'process': 'preload script / renderer'}});
crashReporter.start({companyName: 'Symphony', uploadToServer: false, extra: {'process': 'preload script / renderer'}});
createAPI();
// creates API exposed from electron.

View File

@ -93,7 +93,7 @@ function doCreateMainWindow(initialUrl, initialBounds) {
let url = initialUrl;
let key = getGuid();
crashReporter.start({companyName: 'Symphony', uploadToServer: false, submitURL: 'http://localhost:3000/', extra: {'process': 'renderer / window manager'}});
crashReporter.start({companyName: 'Symphony', uploadToServer: false, extra: {'process': 'renderer / window manager'}});
log.send(logLevels.INFO, 'creating main window url: ' + url);
let newWinOpts = {