From d56f67b7af47e8504e7eaee5f2d291780dbbc871 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 6 Jan 2020 11:00:27 -0500 Subject: [PATCH] refactor: throw error for getLastCrashReport if crashReporter not started (#21643) --- lib/common/crash-reporter.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/common/crash-reporter.js b/lib/common/crash-reporter.js index 9219af0807d5..bae09ddc7b4b 100644 --- a/lib/common/crash-reporter.js +++ b/lib/common/crash-reporter.js @@ -54,7 +54,12 @@ class CrashReporter { } getUploadedReports () { - return binding.getUploadedReports(this.getCrashesDirectory()) + const crashDir = this.getCrashesDirectory() + if (!crashDir) { + throw new Error('crashReporter has not been started') + } + + return binding.getUploadedReports(crashDir) } getCrashesDirectory () {