|
From: Steve C. <ste...@ya...> - 2004-11-19 09:24:08
|
On Thu, 2004-11-18 at 18:05 +0000, Jochen Voss wrote:
> 4) some ideas:
>
> - The backends could return errors via python standard exceptions
> without printing messages and such. This leads to simple code,
> feels quite Pythonic, makes the backends more independent of the
> error reporting policy and at the moment seems to be the only sane
> solution to me.
>
> - The backends should have a function which the matlab interface can
> call to report errors to the user. This should pop up a dialog
> etc. on GUI backends and just print the message to stderr for
> non-GUI backends. It should not terminate the program.
I agree with these ideas.
> 7) Conclusions:
>
> I suggest the following.
>
> - Change backend_template.py and all the other non-GUI backends to
>
> def error_msg_ps(msg, *args):
> """
> Signal an error condition.
> """
> sys.stderr.write('Error: %s' % msg)
I'd prefer to merge error_msg into the Verbose class, or just delete it.
> - Change all callers of error_msg to terminate the program after the
> call when appropriate
Agree
> - Remove the verbose.report_error function and replace it with Python
> exceptions etc.
Agree
> What do you think?
At the moment we have error_msg(), the Verbose class and exceptions all
working in the same area and a bit of confusion as to which one does
what. I don't think we need all three.
I suggest
- using exceptions to handle errors that may terminate the program, and
allowing the matlab interface, GUI backends and user scripts to catch
these exceptions.
- using verbose for all reporting
- merging error_msg() into the Verbose class (with the GUI backends
possibly subclassing Verbose to provide a popup error dialog)
Steve
|