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
This commit is contained in:
Evan Morikawa 2017-01-10 12:15:00 -08:00
parent e2302fe1c0
commit 892ef96116
2 changed files with 14 additions and 1 deletions

2
src/K2

@ -1 +1 @@
Subproject commit 7da14f7cb73237951a0be8a0a2a8386db5d2557e Subproject commit 802d50dd5a59ff40aaa91c8e649cd32ac535bc41

View file

@ -15,6 +15,8 @@ if (process.type === 'renderer') {
app = require('electron').app; app = require('electron').app;
} }
var crashReporter = require('electron').crashReporter
// A globally available ErrorLogger that can report errors to various // A globally available ErrorLogger that can report errors to various
// sources and enhance error functionality. // sources and enhance error functionality.
// //
@ -38,6 +40,8 @@ module.exports = ErrorLogger = (function() {
this.inDevMode = args.inDevMode this.inDevMode = args.inDevMode
this.resourcePath = args.resourcePath this.resourcePath = args.resourcePath
this._startCrashReporter()
this._extendErrorObject() this._extendErrorObject()
this._extendNativeConsole() this._extendNativeConsole()
@ -97,6 +101,15 @@ module.exports = ErrorLogger = (function() {
////////////////////////// PRIVATE METHODS ////////////////////////// ////////////////////////// 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) { ErrorLogger.prototype._extendNativeConsole = function(args) {
console.debug = this._consoleDebug.bind(this) console.debug = this._consoleDebug.bind(this)