From ab62f32a42bccfce3da61bb740adbb4cb683126c Mon Sep 17 00:00:00 2001 From: KorbsStudio Date: Fri, 17 Feb 2023 18:02:24 -0500 Subject: [PATCH] Add Crash Reporter (Tested with BugSplat) --- .env | 10 ++++++---- electron/index.js | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.env b/.env index 6fd6bd0..b0d81f3 100644 --- a/.env +++ b/.env @@ -21,10 +21,12 @@ SourceCode="https://github.com/company/app-name" LoadingIndicator="Spinner" # "Spinner" "ProgressBar" "JumpingBalls" "GlowingBars" SplashBackground="#232323" -# Notifications +## Notifications - For Pushy +NotificationType="Native" # "Custom" "Native" + +# Pushy Notifications # Document: https://nexus-polestar.korbsstudio.com/basics/notifications/ -## Pushy PushyAppId="63e9212d7446e48a2a0e8ec0" -## Theming -NotificationType="Native" # "Custom" "Native" \ No newline at end of file +# Crash Reporter +CrashReportServer: "https://nexuspolestar.bugsplat.com/post/electron/crash.php" \ No newline at end of file diff --git a/electron/index.js b/electron/index.js index 3ef7cb6..cc5974c 100644 --- a/electron/index.js +++ b/electron/index.js @@ -1,5 +1,5 @@ // ElectronJS -const {app, BrowserWindow, Menu, Notification} = require('electron') +const {app, BrowserWindow, Menu, nativeTheme, Notification, crashReporter} = require('electron') // Dependenies by Korbs Studio const glasstron = require('glasstron-clarity') @@ -12,6 +12,7 @@ const Pushy = require('pushy-electron') // Needed for other stuff const path = require('path') +const bugsplat = require("bugsplat"); let mainWindow // Grab .env options @@ -201,6 +202,20 @@ function createWindow () { Menu.setApplicationMenu(menu) } +// Crash Reporter +crashReporter.start({ + productName: process.env.Name, + submitURL: process.env.CrashReportServer, +}) + +const javaScriptErrorHandler = async (error) => { + await bugsplat.post(error); + app.quit(); +} + +// If you want test the crash reporter, uncomment the code below and wait a few moments. +// setTimeout(() => {process.crash()}, 2400) // Wait a moment, then crash.z + // App app.whenReady().then(() => { createWindow()