From: Mike C. F. <mcf...@ro...> - 2005-09-17 05:33:48
|
Antony Kummel wrote: >Hi, > >Why not make send return the instances of exceptions >if any occured in a receiver instead of making the >whole operation break and possibly leave the user's >system in an invalid state? I don't mind doing this >too, if deemed useful. > > Altering the *current* API like this would *not* be advisable. It would have all sorts of ugly potential failure cases (where a user is assuming errors will propagate the stop). Adding a new "sendRobust" might be well received. Probably do it as a separate module (i.e. from dispatch.robust import sendRobust) rather than making it part of the "dispatcher" namespace? The problem then is that as soon as you do that, you realise what you actually want is something like a Twisted.python.failure.Failure object, i.e. something that lets you get at the traceback for the individual failure as well, or you could do it with callbacks and errbacks... or... there's just so many different variations on the theme that it's hard to know which really belong in the core. A straightforward sendRobust implementation (no tracebacks, just the error instances) is probably a good idea for the core, though. Okay, that's added now. Have fun, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |