From 6f76108e51a8449c9c6b53d34be8a0bb6af624ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Og=C3=B3rek?= Date: Fri, 17 Nov 2017 15:01:53 +0100 Subject: [PATCH 1/3] docs: Electron integration docs --- docs/integrations/electron.rst | 40 ++++++++++++++++++++++++++++++++++ docs/sentry-doc-config.json | 9 ++++++++ 2 files changed, 49 insertions(+) create mode 100644 docs/integrations/electron.rst diff --git a/docs/integrations/electron.rst b/docs/integrations/electron.rst new file mode 100644 index 000000000000..579c49504156 --- /dev/null +++ b/docs/integrations/electron.rst @@ -0,0 +1,40 @@ +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``, where 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 Node.js SDK: + +.. code-block:: javascript + + var Raven = require('raven'): + + Raven.config('___PUBLIC_DSN___', { + captureUnhandledRejections: true + }).install(); + +And now ``renderer process``, which uses 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 handle promises errors, which be handled in various way, however, by default Electron uses standard JS API. +To learn more about handling promises, refer to :doc:`Promises <../usage#promises>` documentation. diff --git a/docs/sentry-doc-config.json b/docs/sentry-doc-config.json index 952721450f20..70ae197e6532 100644 --- a/docs/sentry-doc-config.json +++ b/docs/sentry-doc-config.json @@ -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", From 3f506a08cc633a0d3994b1f18b06a97196fc7c4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Og=C3=B3rek?= Date: Mon, 20 Nov 2017 12:02:04 +0100 Subject: [PATCH 2/3] docs: Add platform tags to Electron integration --- docs/integrations/electron.rst | 36 +++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/docs/integrations/electron.rst b/docs/integrations/electron.rst index 579c49504156..81bb2017d7a2 100644 --- a/docs/integrations/electron.rst +++ b/docs/integrations/electron.rst @@ -19,7 +19,7 @@ First, let's configure ``main process``, which uses Node.js SDK: .. code-block:: javascript - var Raven = require('raven'): + var Raven = require('raven'); Raven.config('___PUBLIC_DSN___', { captureUnhandledRejections: true @@ -29,12 +29,42 @@ And now ``renderer process``, which uses Browser SDK: .. code-block:: javascript - var Raven = require('raven-js') ; + var Raven = require('raven-js'); Raven.config('___PUBLIC_DSN___').install(); window.addEventListener('unhandledrejection', function (event) { Raven.captureException(event.reason); }); -This configuration will also handle promises errors, which be handled in various way, however, by default Electron uses standard JS API. +This configuration will also take care of unhandled Promise rejections, which can be handled in various way, however, 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 alongside with 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 his, require standard Node.js module `os` and add `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(); From fe3bfc58f5ae3b6bdfefa59f482ff37ee5a84d7f Mon Sep 17 00:00:00 2001 From: Jan Michael Auer Date: Mon, 20 Nov 2017 12:13:53 +0100 Subject: [PATCH 3/3] ref: Minor wording changes --- docs/integrations/electron.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/integrations/electron.rst b/docs/integrations/electron.rst index 81bb2017d7a2..5f38b7b098a2 100644 --- a/docs/integrations/electron.rst +++ b/docs/integrations/electron.rst @@ -2,7 +2,7 @@ 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``, where Node.js is used to report ``main process`` errors. +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>`. @@ -15,7 +15,7 @@ Both packages are available via npm. $ npm install raven raven-js --save -First, let's configure ``main process``, which uses Node.js SDK: +First, let's configure ``main process``, which uses the Node.js SDK: .. code-block:: javascript @@ -25,7 +25,7 @@ First, let's configure ``main process``, which uses Node.js SDK: captureUnhandledRejections: true }).install(); -And now ``renderer process``, which uses Browser SDK: +And now ``renderer process``, which uses the Browser SDK: .. code-block:: javascript @@ -36,14 +36,14 @@ And now ``renderer process``, which uses Browser SDK: Raven.captureException(event.reason); }); -This configuration will also take care of unhandled Promise rejections, which can be handled in various way, however, by default Electron uses standard JS API. +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 alongside with caught error. -Some things that we can easily add, but are not limited to are: +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 @@ -51,7 +51,7 @@ Some things that we can easily add, but are not limited to are: - Operation System type - Operation System release -You can configure both processes in the same way. To do his, require standard Node.js module `os` and add `tags` attribute to your `config` call: +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