'Capture exceptions for event handlers that run
in individual threads.
:param func: The event handler to execute.
:param args: Arguments to the event handler.'

def _threaded_event_wrapper(self, func, args):

    orig = args[0]
    try:
        func(*args)
    except Exception as e:
        error_msg = u'Error    processing    event    handler:    %s'
        log.exception(error_msg, str(func))
        if hasattr(orig, u'exception'):
            orig.exception(e)
        else:
            self.exception(e)
