Sanic error handlert that integrates with Sentry
Project description
Sentry error handler for Sanic web server
Requirements
python >= 3.5
Installation
sanic-sentry-error-handler should be installed using pip:
pip install sanic-sentry-error-handler
Usage
SENTRY_DSN - Sentry DSN for your application
To begin we’ll set up a Sanic app:
>>> from sanic import Sanic
>>> from sanic_sentry import SanicSentryErrorHandler
>>> app = Sanic(__name__)
>>> app.error_handler = SanicSentryErrorHandler('http://public:secret@example.com/1')
If your application uses the Sanic exception handling views you might consider using decorator for intercepting the exceptions.
>>> from sanic import response, Sanic
>>> from sanic_sentry import SanicSentryErrorHandler
>>>
>>> sentry_client = SanicSentryErrorHandler('http://public:secret@example.com/1')
>>> app = Sanic(__name__)
>>>
>>>
>>> @app.exception([Exception, ])
>>> @sentry_client.intercept_exception
>>> def handle_exception_500(request, exception):
>>> return response.json({"description": "Internal Server Error"}, status=500)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for sanic-sentry-error-handler-0.1.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ceaa4d6ff8ff263e9b0b0290464473b7f7721fa5577f48c800398a492e332e92 |
|
MD5 | b881e1e130670e48bfab2050e68a9cc4 |
|
BLAKE2b-256 | e7f63c57151d3beaa55e2eadb4d1040b3849a21c1507b1202f8c1d18805cd8fd |