[Twisted-Python] RE: How do I get the reactor to stop on an exception

Thanks for the quick responses, Jean-Paul & Itamar. It looks like turning my app into a twistd plugin seems to be the preferred method (well, quashing bugs quickly and permanently with Unit Tests is obviously the preferred method :o) !) Itamar,
When using twistd or trial, you can simply use the debug command-line
option for that (-b). Without those,
twisted.python.failure.setDebugMode(True) or something, I forget the exact
invocation.
There is a twisted.python.failure.startDebugMode(), but it doesn't seem to stop the reactor on exceptions (I'm not directly using Deferred's, so maybe that's the reason). I'm mostly using Twisted for it's robust Networking protocols (ok, and a bit of scheduling), and I can't say enough good things about how well it works. I also know Twisted has many more parts to it than the small subset I'm using, but it seems unfortunate to me that including any part of Twisted in a program means that all exceptions are trapped -whether or not the exception has anything to do with Twisted. Regular Python (sans Twisted) doesn't trap exceptions, but I'm sure there are many good reasons for doing so with Twisted (you don't have to list them - I'm not being facetious). I just think it would be useful to be able to set a flag somewhere to stop this behaviour. I will definitely remove this after, but adding a 'raise' statement to the except clause of the RunUntilCurrent method of ReactorBase in base.py seems to do exactly what I want. ...would zero percent be on the high side for the chances of having a Twisted developer make some sort of flag available that would turn this on? (or equivalent functionality) ...just askin... Thanks again for your help/advice guys, Gerrat
participants (1)
-
Gerrat Rickert