[Twisted-Python] Hooking on unhandled exceptions

Itamar Shtull-Trauring itamar at itamarst.org
Thu May 20 09:14:20 EDT 2004


On Thu, 2004-05-20 at 05:34, Sorin C. wrote:

> I want to catch all unhandled exceptions that usually
> are caught and logged by the reactor. Is there a way
> to hook into reactor to be notified about those
> exceptions?

def errorObserver(d):
    if d.has_key("isFailure") and d["isFailure"]:
        f = d["failure"]
        # do stuff to f

from twisted.python import log
log.addObserver(errorObserver)

-- 
Itamar Shtull-Trauring    http://itamarst.org






More information about the Twisted-Python mailing list