{% extends "sentry/partial/client_config/python_base.html" %} {% load i18n %} {% block inner %}
{% trans "Add the required configuration in your application setup:" %}
import tornado.web from raven.contrib.tornado import AsyncSentryClient class MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello, world") application = tornado.web.Application([ (r"/", MainHandler), ]) application.sentry_client = AsyncSentryClient( '{% if dsn %}{{ dsn }}{% else %}SENTRY_DSN{% endif %}' )
{% blocktrans %}Once the sentry client is attached to the application, request handlers can automatically capture uncaught exceptions by inheriting the SentryMixin class.{% endblocktrans %}
import tornado.web from raven.contrib.tornado import SentryMixin class UncaughtExceptionExampleHandler(SentryMixin, tornado.web.RequestHandler): def get(self): 1 / 0{% endblock %}