From 892ef96116347641c9bf2bfefccb818b9a058496 Mon Sep 17 00:00:00 2001 From: Evan Morikawa Date: Tue, 10 Jan 2017 12:15:00 -0800 Subject: [PATCH] feat(crash): add electron crash reporter Summary: Adds electron's crash reporter. This is currently going to a dumb heroku app I setup: https://github.com/emorikawa/electron-crash-report-server It's going there for now since I want to first evaluate if this is useful before spending the time to build it in N1-Cloud and taking the risk of getting flooded by crash reports. The crash reports themselves are very difficult to debug since it requires compiling tools that can read os-specific memory dumps Electron seems to be crashing fairly frequently for some unkonwn reason, and this is really the only diagnostic tool we have to potentially see why Test Plan: manual Reviewers: spang, juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3629 --- src/K2 | 2 +- src/error-logger.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/K2 b/src/K2 index 7da14f7cb..802d50dd5 160000 --- a/src/K2 +++ b/src/K2 @@ -1 +1 @@ -Subproject commit 7da14f7cb73237951a0be8a0a2a8386db5d2557e +Subproject commit 802d50dd5a59ff40aaa91c8e649cd32ac535bc41 diff --git a/src/error-logger.js b/src/error-logger.js index b46521ebb..30ba8e0e2 100644 --- a/src/error-logger.js +++ b/src/error-logger.js @@ -15,6 +15,8 @@ if (process.type === 'renderer') { app = require('electron').app; } +var crashReporter = require('electron').crashReporter + // A globally available ErrorLogger that can report errors to various // sources and enhance error functionality. // @@ -38,6 +40,8 @@ module.exports = ErrorLogger = (function() { this.inDevMode = args.inDevMode this.resourcePath = args.resourcePath + this._startCrashReporter() + this._extendErrorObject() this._extendNativeConsole() @@ -97,6 +101,15 @@ module.exports = ErrorLogger = (function() { ////////////////////////// PRIVATE METHODS ////////////////////////// ///////////////////////////////////////////////////////////////////// + ErrorLogger.prototype._startCrashReporter = function(args) { + crashReporter.start({ + productName: 'Nylas Mail', + companyName: 'Nylas', + submitURL: 'https://electron-crash-report-server.herokuapp.com/', + autoSubmit: true, + }) + } + ErrorLogger.prototype._extendNativeConsole = function(args) { console.debug = this._consoleDebug.bind(this)