Will sentry automatically upload un-catched exception?

I just got a new notification of exception ( my project is written by python), I check my code, I don’t have any code to handle this exception. So it seems that sentry is doing this for me. Is this a expected behavior?

Hi Scott,

Yes, the SDK will try very hard to catch uncaught exceptions. I assume you are using sentry-sdk: If you don’t want this behavior at all you can pass default_integrations=False.

Thanks. actually, this is a very useful feature, because it allow us get started with this lib without too much effort. one of my colleague encountered another problem: the process will exit immediately when some exception occurs, it seems that sentry-sdk will not have enough time to log this, we could put the whole process into a big try-except to catch this manually, but this will requires a lot of work if we want enable sentry-sdk for all of our project. Do you have any tricks for this?

Hi Scott,

The SDK will delay the process shutdown by up to 2 seconds (configurable) to allow pending events to be sent.

Sometimes this doesn’t work out as planned, but there can be many reasons for this. If you’re experiencing this it’d be great if you could prepare a minimal example and/or tell me what frameworks you use.

Thanks. I was unable to create a minimal example by just simulating the exception. Actually, I was even unable to re-produce and solve the bug in our project. It’s a deep-learning and data mining project, we use tensorflow, pandas, numpy and many other libs, we create a lot process and thread to speed up. I am waiting the bug occurs again. The good news is now we will be notified when something is wrong. It’s a very good library.

Hi scott,

The SDK is known to have issues with daemon threads and the multiprocessing module. I would recommend to wrap your entire application in a with-statement like this:

with sentry_sdk.init(...):
    main()

this should work around 99% of shutdown-related problems you’d see.

thanks. I will try that. it’s a very neat solution