Skip to main content

Capture Sentry exceptions in Graphene views

Project description

graphene-sentry

This package is based on graphene-django-sentry (Github page) package.

Main focus of package was to fix issue with sentry reporting with graphene_django package.

I think this package can be extended to handle nore cases.

Survey is needed if you faced similar problem with sentry report with other frameworks or graphene implementations let me know via issues.

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:

  1. Sentry will show the true exceptions.
  2. Graphene will continue to work like normal.

Works with:

  • Python 3.6+
  • Django 2.1+
  • graphene-django 2.2+

image

image

image

image

image

Installing the project is easy:

pip install graphene-sentry

Example without file upload:

# urls.py

from .schema import schema
from graphene_sentry.views import SentryGraphQLView

urlpatterns = [
    url(
        r'^graphql',
        csrf_exempt(SentryGraphQLView.as_view(schema=schema)),
        name='graphql',
    ),
]

Example with graphene file upload:

# urls.py

from .schema import schema
from graphene_sentry.views import SentryFileUploadGraphQLView

urlpatterns = [
    url(
        r'^graphql',
        csrf_exempt(SentryFileUploadGraphQLView.as_view(schema=schema)),
        name='graphql',
    ),
]

What can I do?

  • Capture Sentry exceptions properly when they are raise-d in Graphene views.

Status

graphene-sentry is currently stable and suitable for use.

Credits

This package is based on graphene-django-sentry author @phalt

This package was created with Cookiecutter.

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

graphene-sentry-0.4.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

graphene_sentry-0.4.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file graphene-sentry-0.4.0.tar.gz.

File metadata

  • Download URL: graphene-sentry-0.4.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.9

File hashes

Hashes for graphene-sentry-0.4.0.tar.gz
Algorithm Hash digest
SHA256 2dff91126bb208fa5c09a43088f88d2428a7d9997dbdb138a6f16b7325c483df
MD5 5a6874e53dcc404d13543f178ecb9ee7
BLAKE2b-256 d2c149fe1255a2bdad4018e87a15acc6988906ca32cd3b03fd28756fe077db09

See more details on using hashes here.

File details

Details for the file graphene_sentry-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: graphene_sentry-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.9

File hashes

Hashes for graphene_sentry-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e62823665cf9c8f1cfc9795c840d8fc3250de053ba699f95d1a38d0ae952341
MD5 c93298121177bf590f996ea2682e081d
BLAKE2b-256 e3e1326871a387bbf4dd8555a661cd8446a7335db1099f0b6bd1a5f3f9575fc0

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