{% load i18n %}

{% blocktrans with 'https://github.com/mattrobenolt/raven-node' as link %}Start by installing raven-node:{% endblocktrans %}

npm install raven

{% trans "Create an instance of the client:" %}

var raven = require('raven');

var client = new raven.Client('{% if dsn %}{{ dsn }}{% else %}SENTRY_DSN{% endif %}');

{% trans "You can also optionally install a default error handler to catch all exceptions:" %}

client.patchGlobal();

{% trans "Ensure Node is run with NODE_ENV=production:" %}

NODE_ENV=production node script.js

{% trans "Now call out to the raven client to capture events:" %}

// {% trans "record a simple message" %}
client.captureMessage('hello world!')

// {% trans "capture an exception" %}
client.captureError(new Error('Uh oh!!'));

{% blocktrans with 'https://github.com/mattrobenolt/raven-node' as link %}For more information on other uses of Raven with Node.js, please see the official documentation for raven-node.{% endblocktrans %}