Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions docs/integrations/electron.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Electron
========

To use Sentry with your Electron application, you will need to use both Raven.js SDKs, one for Browser and one for Node.js.
Browser SDK is used to report all errors from Electron's ``renderer process``, while Node.js is used to report ``main process`` errors.

On its own, Raven.js will report any uncaught exceptions triggered from your application. For advanced usage examples of Raven.js, please read :doc:`Raven.js usage <../usage>`.

Installation
------------

Both packages are available via npm.

.. code-block:: sh

$ npm install raven raven-js --save

First, let's configure ``main process``, which uses the Node.js SDK:

.. code-block:: javascript

var Raven = require('raven');

Raven.config('___PUBLIC_DSN___', {
captureUnhandledRejections: true
}).install();

And now ``renderer process``, which uses the Browser SDK:

.. code-block:: javascript

var Raven = require('raven-js');
Raven.config('___PUBLIC_DSN___').install();

window.addEventListener('unhandledrejection', function (event) {
Raven.captureException(event.reason);
});

This configuration will also take care of unhandled Promise rejections, which can be handled in various ways. By default, Electron uses standard JS API.
To learn more about handling promises, refer to :doc:`Promises <../usage#promises>` documentation.

Sending environment information
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It's often a good idea to send platform information along with a caught error.
Some things that we can easily add, but are not limited to, are:

- Environment type (browser/renderer)
- Electron version
- Chrome version
- Operation System type
- Operation System release

You can configure both processes in the same way. To do this, require the standard Node.js module `os` and add a `tags` attribute to your `config` call:

.. code-block:: javascript

var os = require('os');
var Raven = require('raven');

Raven.config('___PUBLIC_DSN___', {
captureUnhandledRejections: true,
tags: {
process: process.type,
electron: process.versions.electron,
chrome: process.versions.chrome,
platform: os.platform(),
platform_release: os.release()
}
}).install();
9 changes: 9 additions & 0 deletions docs/sentry-doc-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@
"integrations/backbone#configuring-the-client"
]
},
"javascript.electron": {
"name": "Electron",
"type": "framework",
"doc_link": "integrations/electron/",
"wizard": [
"integrations/electron#installation",
"integrations/electron#configuring-the-client"
]
},
"javascript.ember": {
"name": "Ember",
"type": "framework",
Expand Down