{% load i18n %}

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

<script src="//{{ SENTRY_RAVEN_JS_URL }}"></script>
{% url 'sentry-manage-project' project.organization.slug project.slug as project_link %}

{% blocktrans %}Add any URLs which will be logging errors in your project's settings under Client Security:{% endblocktrans %}

{% trans "Configure the client:" %}

<script>
Raven.config('{% if dsn_public %}{{ dsn_public }}{% else %}SENTRY_DSN{% endif %}', {
    // we highly recommend restricting exceptions to a domain in order to filter out clutter
    whitelistUrls: ['example.com/scripts/']
}).install();
</script>

{% trans "Add additional user context if it's available:" %}

Raven.setUser({
    email: 'user@example.com',
    id: 'username'
});

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

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

// {% trans "capture an exception" %}
try {
    errorThrowingCode();
} catch(err) {
    Raven.captureException(err);
}

{% blocktrans with 'http://raven-js.readthedocs.org/' as link %}For more information on other uses of Raven with Javascript, please see the official documentation for raven-js.{% endblocktrans %}