Sentry support on python can not handle unexpected exceptions?

And have a try about this with python support. Link is here:

1> From above docs,

from raven import Client

client = Client('https://<key>:<secret><project>')

    1 / 0
except ZeroDivisionError:

It seems as a developer, I need to catch related exception, and call “captureException”, so it can not work with unexpected exceptions(python code not catch and call captureException).

2> Also, I tried the django according to

it only get events when I call captureException explicitly, for other exceptions, like “AttributeError: ‘NoneType’ object has no attribute”, it not know.(since you did not have captureException code about that )

So what’s the typical use cases for sentry ?

Look into raven.middleware – the answer, in any language, is to have a catch-mostly-all handler at the top level of an app (or in a WSGI middleware, for Python web services).

Hi @jhermann Thanks. I will check in the middleware side. seems it is a good place to do that.

Hi @jhermann Update. I found a new issue,. I not add

any middleware magic, or like application = Sentry(get_wsgi_application())

But it seems sentry can still capture all unexpected exception. Do you know why ?

I seems can not reproduce the old issue described above.

That code IS middleware addition.

hi @jhermann Thanks for your reply.

Just confirm, according to my experiments now.

We not need add any middleware magic. just with folliowing


import os
import raven

    'dsn': 'https://<key>:<secret><project>',
    # If you are using git, you can also automatically configure the
    # release based on the git info.
    'release': raven.fetch_git_sha(os.path.dirname(os.pardir)),

The django application any unexpected exceptions can be caught.

Or anything else I missed ?