Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Electron crashReporter module


May 25, 2021 Electron


Table of contents


crash-reporter opens to send app crash reports.

Here is an example of an automatic crash report to the server:

const crashReporter = require('electron').crashReporter;

crashReporter.start({
  productName: 'YourName',
  companyName: 'YourCompany',
  submitURL: 'https://your-domain.com/url-to-submit',
  autoSubmit: true
});

You can use the following items to create a server to receive and process crash reports:

Method

crash-reporter module has the following methods:

crashReporter.start(options)

  • options Object
    • companyName String
    • submitURL String - Crash report sends the path in post mode.
    • productName String (optional) - Electron .
    • autoSubmit Boolean - Whether auto-submit. True by true .
    • ignoreSystemCrashHandler Boolean - false by false .
    • extra Object - an object that you can define and send together on the crash report . Only string properties can be sent correctly and nested objects are not supported.

You can only use this method before using other crashReporter crashReporter APIs.

Note: At OS X, Electron uses a new crashpad client, unlike Windows and breakpad In order to turn on crash point collection, you need to call crashReporter.start API in the main process and in every other rendering process where you need to collect crash reports to crashpad .

crashReporter.getLastCrashReport()

Returns the date and ID of the last crash report. If no crash report has been sent, or the crash report collection has not started, null .

crashReporter.getUploadedReports()

Returns all uploaded crash reports, each containing the upload date and ID.

crash-reporter Payload

The crash report sends the multipart/form-data POST type of data submitURL :

  • ver String - Electron version.
  • platform String - e.g. 'win32'.
  • process_type String - e.g. 'renderer'.
  • guid String - e.g. '5e1286fc-da97-479e-918b-6bfb0c3d1c72'
  • _version String - package.json version.
  • _productName of the product in the String - crashReporter crashReporter options object.
  • prod String - Base product name. This situation is Electron.
  • _companyName of the company in the String - options crashReporter options object.
  • upload_file_minidump File - Crash report in minidump format.
  • All levels and a extra object in crashReporter options object