{ "html": "
If you haven’t already, start by downloading Raven. The easiest way is\nwith pip:
\npip install raven --upgrade\n
The first thing you’ll need to do is to disable catchall in your Bottle app:
\nimport bottle\n\napp = bottle.app()\napp.catchall = False\n
Note
\nBottle will not propagate exceptions to the underlying WSGI\nmiddleware by default. Setting catchall to False disables that.
\nSentry will then act as Middleware:
\nfrom raven import Client\nfrom raven.contrib.bottle import Sentry\nclient = Client('___DSN___')\napp = Sentry(app, client)\n
Once you’ve configured the Sentry application you need only call run with it:
\nrun(app=app)\n
If you want to send additional events, a couple of shortcuts are provided\non the Bottle request app object.
\nCapture an arbitrary exception by calling captureException
:
try:\n 1 / 0\nexcept ZeroDivisionError:\n request.app.sentry.captureException()\n
Log a generic message with captureMessage
:
request.app.sentry.captureMessage('Hello, world!')\n