Add Crash Reporter (Tested with BugSplat)

This commit is contained in:
KorbsStudio 2023-02-17 18:02:24 -05:00
parent be542c747c
commit ab62f32a42
No known key found for this signature in database
2 changed files with 22 additions and 5 deletions

10
.env
View file

@ -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"
# Crash Reporter
CrashReportServer: "https://nexuspolestar.bugsplat.com/post/electron/crash.php"

View file

@ -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()