From: Steve C. <ste...@ya...> - 2004-11-22 09:08:10
|
On Sat, 2004-11-20 at 17:26 -0600, John Hunter wrote: > As for report_error, subclassing Verbose, or using figure manager for > this as Jochen has suggested, are both workable solutions, but what > does it ultimately buy us? I am inclined to the logically cleaner > solution of doing all error handling with exceptions, using a hook > like you've provided for GUIs. By subclassing Verbose you group all the functions that display messages to the user together into one class. I may have misunderstood some of the discussion - I agree with doing all error handling with exceptions, but when you catch the exception in a GUI I'm assuming you still want to popup a message to inform the user. Are you describing using exceptions and tracebacks without any error messages for GUI backends? I don't think you can assume a GUI backend user will see a traceback since the terminal window may be obscured, iconified or even closed. > I grepped for all the current uses of report error (included below) -- > on quick inspection none of these appear fatal for a GUI. I think > simply informing the user of the error may suffice. Can you provide > an example of where we may need to exit (and would it suffice for the > raiser to simply raise a SystemExit for this case?) It does look like they are all non-fatal. I guess the fatal ones are the ones that matplotlib does not anticipate or catch, thinks like faulty installations, missing libraries etc. At the moment these would cause matplotlib to terminate but if we add a default exception handler we will start catching these also. We could have a policy for matplotlib to catch all exceptions and always attempt to continue, and if it becomes unusable its up to the user to close the window. Also we could recognise some situations (if there are any) where we need to terminate, so we raise SystemExit and set the default exception handler to terminate on SystemExit and continue on all other cases. Steve |