123456 |
- {
- "html": "<div class=\"section\" id=\"installation\">\n<h2>Installation</h2>\n<p>All packages are available via npm.</p>\n<div class=\"highlight-sh\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span>$ npm install @sentry/electron --save\n$ npm install @sentry/wizard --save-dev\n</pre></div>\n</div>\n<p>Run the wizard to help you finish your setup:\nWith <code class=\"docutils literal\"><span class=\"pre\">yarn</span></code> you can just call:</p>\n<div class=\"highlight-sh\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span>$ yarn sentry-wizard --integration<span style=\"color: #4b4f5c\">=</span>electron\n</pre></div>\n</div>\n<p>If you only have <code class=\"docutils literal\"><span class=\"pre\">npm</span></code> call:</p>\n<div class=\"highlight-sh\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span>$ node node_modules/.bin/sentry-wizard --integration<span style=\"color: #4b4f5c\">=</span>electron\n</pre></div>\n</div>\n<p><code class=\"docutils literal\"><span class=\"pre\">sentry-wizard</span></code> will display recommended packages like <cite>electron-download</cite> which we need\nto symbolicate native crashes.\nThe wizard will also create a file called <code class=\"docutils literal\"><span class=\"pre\">sentry.properties</span></code> (which contains\nyour account information) and <code class=\"docutils literal\"><span class=\"pre\">sentry-symbols.js</span></code> which helps you with the symbol\nupload.</p>\n</div>\n\n\n<div class=\"section\" id=\"configuring-the-client\">\n<h2>Configuring the Client</h2>\n<p>The following code should reside in the <code class=\"docutils literal\"><span class=\"pre\">main</span> <span class=\"pre\">process</span></code> and all <code class=\"docutils literal\"><span class=\"pre\">renderer</span> <span class=\"pre\">processes</span></code>:</p>\n<div class=\"highlight-javascript\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span><span style=\"color: #2eb0f7\">const</span> <span style=\"color: #111111\">{</span> <span style=\"color: #111111\">SentryClient</span> <span style=\"color: #111111\">}</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #111111\">require(</span><span style=\"color: #e8535a\">'@sentry/electron'</span><span style=\"color: #111111\">);</span>\n\n<span style=\"color: #111111\">SentryClient.create({</span>\n <span style=\"color: #111111\">dsn</span><span style=\"color: #4b4f5c\">:</span> <span style=\"color: #e8535a\">'___PRIVATE_DSN___'</span><span style=\"color: #111111\">,</span>\n <span style=\"color: #34c08b; font-style: italic\">// ...</span>\n<span style=\"color: #111111\">});</span>\n</pre></div>\n</div>\n<p>This configuration will also take care of unhandled Promise rejections, which can be\nhandled in various ways. By default, Electron uses the standard JS API.\nTo learn more about handling promises, refer to <a class=\"reference internal\" href=\"https://docs.getsentry.com/clients/javascript/usage/#raven-js-promises\"><span>Promises</span></a> documentation.</p>\n<div class=\"section\" id=\"uploading-symbols\">\n<h3>Uploading symbols</h3>\n<p>The wizard should create a file called <code class=\"docutils literal\"><span class=\"pre\">sentry-symbols.js</span></code> which takes care of uploading\ndebug symbols to Sentry. Note that this is only necessary whenever you update your\nversion of electron. It usually takes quiet a while because it downloads debug symbols\nof electron and uploads them to Sentry so we can symbolicate your native crashes.\nYou can always execute the script by calling:</p>\n<div class=\"highlight-sh\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span>$ node sentry-symbols.js\n</pre></div>\n</div>\n</div>\n</div>\n",
- "link": "https://docs.getsentry.com/platforms/javascript/guides/electron/",
- "id": "javascript-electron",
- "name": "Electron"
- }
|