From a9b73e0b910b35bff535fecaca8db5e459a479ff Mon Sep 17 00:00:00 2001 From: Janosch Maier Date: Wed, 24 Nov 2021 22:42:09 +0100 Subject: [PATCH] Fix startCrashReporter in error-logger.js --- app/src/browser/main.js | 1 + app/src/error-logger.js | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/src/browser/main.js b/app/src/browser/main.js index 2682102e8..9479aeaed 100644 --- a/app/src/browser/main.js +++ b/app/src/browser/main.js @@ -61,6 +61,7 @@ const setupErrorLogger = (args = {}) => { inDevMode: args.devMode, resourcePath: args.resourcePath, }); + errorLogger.startCrashReporter(); process.on('uncaughtException', errorLogger.reportError); process.on('unhandledRejection', errorLogger.reportError); return errorLogger; diff --git a/app/src/error-logger.js b/app/src/error-logger.js index 90808baed..bd1da3c38 100644 --- a/app/src/error-logger.js +++ b/app/src/error-logger.js @@ -28,15 +28,14 @@ var RavenErrorReporter = require('./error-logger-extensions/raven-error-reporter // // The errorLogger will report errors to a log file as well as to 3rd // party reporting services if enabled. -module.exports = ErrorLogger = (function() { +module.exports = ErrorLogger = (function () { function ErrorLogger(args) { this.reportError = this.reportError.bind(this); + this.startCrashReporter = this.startCrashReporter.bind(this); this.inSpecMode = args.inSpecMode; this.inDevMode = args.inDevMode; this.resourcePath = args.resourcePath; - this._startCrashReporter(); - this._extendErrorObject(); this._extendNativeConsole(); @@ -101,12 +100,8 @@ module.exports = ErrorLogger = (function() { console.error(error, extra); }; - ///////////////////////////////////////////////////////////////////// - ////////////////////////// PRIVATE METHODS ////////////////////////// - ///////////////////////////////////////////////////////////////////// - - ErrorLogger.prototype._startCrashReporter = function(args) { - /* crashReporter.start({ + ErrorLogger.prototype.startCrashReporter = function () { + crashReporter.start({ productName: 'Mailspring', companyName: 'Mailspring', submitURL: `https://id.getmailspring.com/report-crash?ver=${appVersion}&platform=${process.platform}`, @@ -116,10 +111,14 @@ module.exports = ErrorLogger = (function() { ver: appVersion, platform: process.platform, }, - }) */ + }) }; - ErrorLogger.prototype._extendNativeConsole = function(args) { + ///////////////////////////////////////////////////////////////////// + ////////////////////////// PRIVATE METHODS ////////////////////////// + ///////////////////////////////////////////////////////////////////// + + ErrorLogger.prototype._extendNativeConsole = function (args) { console.debug = this._consoleDebug.bind(this); };