Skip to main content

Sanic error handlert that integrates with Sentry

Project description

Travis PyPI

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

sanic-sentry-error-handler-0.1.7.tar.gz (2.9 kB view details)

Uploaded Source

File details

Details for the file sanic-sentry-error-handler-0.1.7.tar.gz.

File metadata

File hashes

Hashes for sanic-sentry-error-handler-0.1.7.tar.gz
Algorithm Hash digest
SHA256 b4a40a83ee86ff5ee4d83e52cc9a7f24f1bc1cb934a1c438545d3df64cd08acc
MD5 4a6eb0591bbad7866fc0a3b4667327ba
BLAKE2b-256 a6224125cdae4716c518247fccc67d2ac81efb6d1afea4fdf0b879c63e5cd1d4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page