Re: need argument for try catch blocks
"Fred Zwarts" <F.Zwarts@KVI.nl> writes:
Should the destructor ignore it and let the program continue,
or is it better to let the exception leave the destructor, so that the
program will terminate,
The common answer in the Java world is to log the inner exception,
so that it does not get lost, but can be found in some log file.
What else needs to be done is application specific, so there cannot
be a general rule for it. (That's the reason why client code is made
to handle exceptions of a library at all. Would it be obvious what
to do independent of the application, the library would already
have done it itself.)
When a programmer writes code for himself, a program terminated by
some exceptions is usable as the programmer then can trace down what
happend. A customer may not be able to interpret and handle this.
A program intended for a customer should give some
explanation of what happend in a language the customer can
understand. At least something like ?An unexpected error
happened while trying to close the database link. Since this
application needs an intact database, it had to be terminated.?
For this to happen, code might catch the exception, log the
exception, emit a user-readable message, and then rethrow
the exception, which might have the consequence of
terminating the application.