I've updated backend_gtk.py in cvs to use a default
> exception handler, and noticed a few things in the process:
> - sys.excepthook does not catch SystemExit, which is what
> we wanted anyway.
I think the full exception should be printed. It makes debugging very
hard, otherwise. In fact, while recently debugging some code, I
commented out the exception handler for this reason. matplotlib.cbook
provides a method exception_to_str to convert a traceback to a string.
> - for some errors I needed to display a matplotlib message
> rather than the default exception message, or to raise an
> exception where error_msg () was used with no exception. I
> added an 'MPLError' exception, its probably best to move it
> into a central file if other people need to use it also.
Perhaps in matplotlib.__init__ ?
> - changing from error_msg() to raise exception means the
> rest of the method will not execute, which I hadn't thought
> about. This is no good for 'get_filename_from_user()' where
> I want to loop until a file (or Cancel) is selected. So I
> think GTK still has a need to use of a popup message dialog
> occasionally. And for print_figure() it means the section
> of code to restore figure settings will not get executed
> after an error.
I agree that a general facility to popup a message is useful How
abouts we follow Jochen's suggestion and make is a FigureManager
As for your get_filename / restore figure problems, can't these be
addressed by try/catching the exceptions locally, and restoring the
figure state before forwarding the exception onwards?