From: Marc H. <ax...@cu...> - 2001-06-05 01:42:09
|
I would propose a main dsia exception class from which all other exceptions derive, but the actual cases for exception uses have to be defined in a clean way, IMHO. I agree with Manfred that there are cases where exceptions are not that useful, but Kaltan's right, too, I think. I think they should be used instead of error codes, because through deriving one can easily decide whether the error code does interest me. Example: CException -> CFileException -> CFileNotFoundException | -> CFileNoPermissionException My code could call a function 'foo' that throws a CFileNotFoundException, then I could choose to catch a CFileNotFoundException and try to do something, if that doesn't work I throw the exception further. The next catch would handle CFileException and display an error message, for example. If 'foo' would throw a CFileNoPermissionException, then I would get at least an error message, if it throws a CFileNotFoundException my code would try to fix it, and if it didn't succeed I get an error message. So exceptions _are_ necessary, and thought about that for weeks, but was too lazy to implement it :-) Marc -- Marc Haisenko The 3Dsia Project (http://threedsia.sourceforge.net) mailto: ax...@cu... mailto: M.H...@ja... |