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" LoadingIndicator="Spinner" # "Spinner" "ProgressBar" "JumpingBalls" "GlowingBars"
SplashBackground="#232323" SplashBackground="#232323"
# Notifications ## Notifications - For Pushy
NotificationType="Native" # "Custom" "Native"
# Pushy Notifications
# Document: https://nexus-polestar.korbsstudio.com/basics/notifications/ # Document: https://nexus-polestar.korbsstudio.com/basics/notifications/
## Pushy
PushyAppId="63e9212d7446e48a2a0e8ec0" PushyAppId="63e9212d7446e48a2a0e8ec0"
## Theming # Crash Reporter
NotificationType="Native" # "Custom" "Native" CrashReportServer: "https://nexuspolestar.bugsplat.com/post/electron/crash.php"

View file

@ -1,5 +1,5 @@
// ElectronJS // ElectronJS
const {app, BrowserWindow, Menu, Notification} = require('electron') const {app, BrowserWindow, Menu, nativeTheme, Notification, crashReporter} = require('electron')
// Dependenies by Korbs Studio // Dependenies by Korbs Studio
const glasstron = require('glasstron-clarity') const glasstron = require('glasstron-clarity')
@ -12,6 +12,7 @@ const Pushy = require('pushy-electron')
// Needed for other stuff // Needed for other stuff
const path = require('path') const path = require('path')
const bugsplat = require("bugsplat");
let mainWindow let mainWindow
// Grab .env options // Grab .env options
@ -201,6 +202,20 @@ function createWindow () {
Menu.setApplicationMenu(menu) 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
app.whenReady().then(() => { app.whenReady().then(() => {
createWindow() createWindow()