Skip to content

Instantly share code, notes, and snippets.

@VerteDinde
Created April 3, 2023 21:12
Show Gist options
  • Save VerteDinde/2bb5a89db1c72116615dba408f60df74 to your computer and use it in GitHub Desktop.
Save VerteDinde/2bb5a89db1c72116615dba408f60df74 to your computer and use it in GitHub Desktop.
crashReporter testing
<!DOCTYPE html>
<html lang="en">
<head>
<title>CrashReporter</title>
</head>
<body>
<h1>CrashReporter Demo</h1>
</body>
</html>
// Submit crash reports to a remote server.
//
// For more info, see:
// https://electronjs.org/docs/api/crash-reporter
const { app, BrowserWindow, crashReporter } = require('electron')
const path = require('path')
crashReporter.rateLimit = true; // comment this out (2)
crashReporter.start({
productName: 'YourName',
companyName: 'YourCompany',
submitURL: 'https://your-domain.com/url-to-submit',
rateLimit: true, // comment this out (1)
uploadToServer: true
})
app.whenReady().then(() => {
const mainWindow = new BrowserWindow({
height: 600,
width: 600,
webPreferences: {
nodeIntegration: false, // default in Electron >= 5
contextIsolation: true, // default in Electron >= 12
preload: path.join(__dirname, 'preload.js')
}
})
mainWindow.loadFile('index.html')
mainWindow.webContents.on('crashed', () => {
consolg.log(`crashReporter params: ${crashReporter.getParameters()}`)
console.log('Window crashed!')
})
})
{
"name": "painstaking-population-pretend-h2r7z",
"productName": "painstaking-population-pretend-h2r7z",
"description": "My Electron application description",
"keywords": [],
"main": "./main.js",
"version": "1.0.0",
"author": "khammond",
"scripts": {
"start": "electron ."
},
"dependencies": {},
"devDependencies": {
"electron": "22.2.1"
}
}
setTimeout(() => {
process.crash()
}, 2000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment