[Twisted-Python] errorhandler example in docs needs work

Alan Ezust alan.ezust at gmail.com
Sun Dec 26 11:24:18 EST 2004


Reading this in the manual:
    http://twistedmatrix.com/documents/current/howto/defer

Example of how to write error handlers for exceptions:

def errorHandler(failure):
    failure.trap(SpamException, EggException)
    # Handle SpamExceptions and EggExceptions

d.addCallback(cookSpamAndEggs)
d.addErrback(errorHandler)

This example is missing something. The #handle SpamExceptions
should have at least one statement after the # like
      print "I am handling the exception"

I look at this example above and I still don't know how to write an
error handler. I shall read further, but I wanted to share my
feedback.




More information about the Twisted-Python mailing list