GUI application death catcher?
peter at engcorp.com
Thu Feb 19 03:54:27 CET 2004
Douglas Alan wrote:
> I'm writing a GUI app in Python that will be used on the International
> Space Station. I'd like for the app to be as robust as possible and,
> consequently, if it crashes, for there to be a log file written and a
> coherent error message displayed to the astronaut.
> My original approach to this was to write an in-process handler in
> Python that would catch all uncaught exceptions and log the error to a
> file and then hand-hold the user. This turned out to be a bit hairy
> because of all the additional possible errors that might happen while
> handling the original error, but I made a decent stab at it.
> Unfortunately, I find that as I keep working on the program, I often
> break the error handler by breaking some utility code that the error
> handler uses. This isn't so good, so it's back to the drawing board a
This sounds a lot like you are writing this without proper unit tests.
If that's true, and if you really have to run this on a Windows machine,
then god help you...
The only thing I can say that might help beyond that :-), is that
reliability and simplicity go hand in hand. It sounds like you are
trying to make this error handler more complicated than it should be,
and in the process are making it as or more likely to fail than the
main app might be! Not a good approach. Go with something really
really simple, and if you want to take a stab at a more sophisticated
(read complicated) arrangement, at least put it inside the really simple
handler that you write first and test really well. That gives you
two levels of protection, the one which you hope is all that's needed,
and the other as a last resort in case the first one blows up too.
More information about the Python-list