refactor: crashReporterInit (#16729)

This commit is contained in:
Milan Burda 2019-02-05 21:56:44 +01:00 committed by Shelley Vohr
parent c486ab207a
commit 6d674eebb1
6 changed files with 59 additions and 67 deletions

View file

@ -2,28 +2,16 @@
const binding = process.atomBinding('crash_reporter')
const errorUtils = require('@electron/internal/common/error-utils')
class CrashReporter {
contructor () {
this.productName = null
this.crashesDirectory = null
}
sendSync (channel, ...args) {
init (options) {
throw new Error('Not implemented')
}
invoke (command, ...args) {
const [ error, result ] = this.sendSync(command, ...args)
if (error) {
throw errorUtils.deserialize(error)
}
return result
}
start (options) {
if (options == null) options = {}
@ -51,7 +39,7 @@ class CrashReporter {
throw new Error('submitURL is a required option to crashReporter.start')
}
const ret = this.invoke('ELECTRON_CRASH_REPORTER_INIT', {
const ret = this.init({
submitURL,
productName
})