From: Eric B. <er...@go...> - 2001-05-28 22:18:56
|
Berend de Boer wrote: > > The only other option I see is a global errno variable, like C. Global? Or just an attribute of class PX_DIRECTORY (or whatever its name is in epoix) in the example of directory creation? > History learns that programmers do not check errors in such > cases. This can lead to security breaches and/or corrupt data. Crashing the program may lead to corrupted data as well. > I also prefer not to think about errors: if there is an error, it is > exceptional, so just quit. If I cannot create a directory, it's not exceptional. I just ask the user to enter an another directory name in the popup window. You prefer not to think about errors, but for people who do care about writing robust code having to deal with exceptions makes life much more complicated than testing for errors. > Have you other solutions or suggestions? As exception raising is done > in just one place it's easy to change into an option or something > elese. Could the use of exceptions or error variables be parameterized, for example use different creation routines if I want operations applied to this object to raise exceptions or set a boolean attribute when an error occurs? Well, an other solution could be to have two sets of routines, one with exceptions and one with an error status boolean to be set on error. This latter solution has the advantage of possibly providing slightly different postconditions for the two sets of routines. -- Eric Bezault mailto:er...@go... http://www.gobosoft.com |