Capture Sentry exceptions in Graphene views
When using Graphene Django, you sometimes want to raise exceptions and capture them in the API.
However, Graphene Django eats the raised exceptions and you won't see it in Sentry! ๐ญ
This package thinly wraps the normal GraphQLView with a handler that deals with Sentry errors properly.
So the results:
- Sentry will show the true exceptions.
- Graphene will continue to work like normal.
Works with:
- Python 3.6+
- Django 2.1+
- graphene-django 2.2+
Installing the project is easy:
pip install graphene-django-sentry
Full blown example:
# urls.py
from .schema import schema
from graphene_django_sentry.views import SentryGraphQLView
urlpatterns = [
url(
r'^graphql',
csrf_exempt(SentryGraphQLView.as_view(schema=schema)),
name='graphql',
),
]
- Capture Sentry exceptions properly when they are raise-d in Graphene views.
graphene-django-sentry is currently stable and suitable for use.
This package was created with Cookiecutter.