hooks.exceptions module

Provides exception hooking functionality.

class hooks.exceptions._ExceptHooks[source]

Bases: hooks.base._HookBase

List class that stores callbacks to be called on an exception.

print_exception(exctype=None, value=None, trace_back=None, callbacks=True)[source]

Called when an exception is raised.

This method hooks sys.excepthook to log all exceptions and call registered callbacks with the provided arguments.


Bases: hooks.base._HookDecorator

Fired when an exception is raised.

The decorated function is passed the following parameters whe an exception is raised:

from hooks.exceptions import ExceptHook

def exception_callback(exc_type, value, trace_back):
    # Code...

See also



The singleton object of the _ExceptHooks class.