[Twisted-Python] how to write a safe catch-all

Chris Withers chris at simplistix.co.uk
Wed Sep 29 13:16:30 EDT 2010

On 29/09/2010 17:16, Phil Mayers wrote:
> No.
> The problem is that your example is malformed.

Well, it's not, it's the reality of the situation and one I'd like to 
protect against; "the scheduler must not die" is the rule I need to make 

> You do this:
>    1. Create a deferred on the "Break" class instance

The "Break" class, in reality, is the bowels of 
twisted.protocols.ftp.FTPClient, copying from my previous mail:

      self.failIfNotConnected(error.getConnectError((err, strerror(err))))
    File "Twisted-8.2.0-py2.5-linux-x86_64.egg/twisted/internet/tcp.py",
line 588, in failIfNotConnected
      del self.connector
--- <exception caught here> ---
    File "ourcode.py", line 180, in checkSchedule
      yield self.sendTransmissions(...)

How can I protect my scheduler against code which doesn't catch an 
exception when it should?



More information about the Twisted-Python mailing list