DEV Community

Discussion on: Catching every single exception with Python

rhymes profile image
rhymes • Edited on

It's more like a catchall error handler, you can still re-raise the exception to make the program behave like it normally does, for example by adding something like:

raise type(value)

to the last line of the hook function.

Another possible usage for this is error logger that send errors to third party services, like for example what sentry-python does here or to intercept Ctrl-C globally, so that you might want to exit a command line script gracefully by releasing whatever resources you might want to release.