
On Oct 14, 2009, at 3:22 AM, Andrew Bennetts wrote:
Glyph Lefkowitz wrote: [...]
I'm answering a question you didn't ask, about logged errors, because I think it's the one you meant to ask. The answer to the question you are actually asking here, i.e. "how do I handle errors in an errback", is quite simple: add another errback. This is sort of like asking how to handle exceptions in an 'except:' block in Python. For example, if you [...]
To think about it another way, what happens when an unhandled exception occurs in a thread? The thread dies, and Python simply throws the traceback at stderr. There's not much else it can reasonably do. If you want to catch (or suppress) that error, you add (another) try/except at the outermost layer of the call stack.
Yah, I started thinking about how far out I'd have to start the try/ except and started to get a headache when I thought about how much code it would have to encompass or, with an alternate approach, how many zillions of little extra blocks I'd have to insert everywhere.
Possibly Twisted could provide some sort of last-ditch error reporting hook, like sys.excepthook in core Python, but I'm not sure it would offer much advantage over writing a log observer that looks for events where isError is set.
I'm going to use the log observer option with tail -f in a separate console window on a linux console that's just sitting there doing nothing anyway. That way, if it shows up on that terminal, something bad is happening. Thanks! S