Hi,
Not wxPython, but an interesting discussion. A good error handling
is probably what makes an app a solid app. But the developper has
to pay for this, more code, more time, encreasing app complexity...
In Jeff's examples, I am inclined for the first version.
i) Exceptions should be ... exceptions. I think, it 's always better
to catch or to try to catch errors before they happen.
ii) In example 1, "error handling/detection" depends solely from the
developper's code and not from the python implementation. The
standard exception classes may change over the time. (fortunately,
"python" is not MS!) But, you know some DeprecationWarnings will
become Errors.
iii) Note that in example 2), FeatureError is not a Standard Exception
Class, but a Jeff's Exception Class. Jeff is a wise programmer.
My advice to borco:
Write a subroutine, like this one,
def MyDivision(a, b):
return a / b
Test it, test Exception Classes, insert try... except, raise errors, write
your own error handler, use traceback, put it in the main(), put it in
a module, put it in others def(),...
It's really worth to understand it.
Jean-Michel Fauth, Switzerland