{ "html": "
\n

Installation

\n

Raven is distributed via npm:

\n
$ npm install raven --save\n
\n
\n
\n\n\n
\n

Configuring the Client

\n

Next you need to initialize the Raven client and configure it to use your Sentry DSN:

\n
var Raven = require('raven');\nRaven.config('___DSN___').install();\n
\n
\n

At this point, Raven is set up to capture and report any uncaught exceptions.

\n

You can optionally pass an object of configuration options as the 2nd argument to Raven.config. For\nmore information, see Configuration.

\n
\n\n\n
\n

Reporting Errors

\n

Raven’s install method sets up a global handler to automatically capture any uncaught exceptions. You can also report errors manually with try...catch and\na call to captureException:

\n
try {\n    doSomething(a[0]);\n} catch (e) {\n    Raven.captureException(e);\n}\n
\n
\n

You can also use wrap and context to have Raven wrap a function and automatically capture any exceptions it throws:

\n
Raven.context(function () {\n  doSomething(a[0]);\n});\n
\n
\n

For more information on reporting errors, see Usage.

\n
\n", "link": "https://docs.getsentry.com/clients/node/", "id": "node", "name": "Node.js" }