Disallow catch without parameter ("LastCatch")

grauzone none at example.net
Mon Oct 26 00:39:40 PDT 2009


Christopher Wright wrote:
>> PS: I wonder, should the runtime really execute finally blocks if an 
>> "Error" exception is thrown? (Errors are for runtime errors, Exception 
>> for normal exceptions.) Isn't it dangerous to execute arbitrary user 
>> code in presence of what is basically an internal error?
> 
> Are all Errors unrecoverable except by immediately aborting the 
> application?
> 
> What about logging?
> 
> What about putting up a reasonable error message for the user?
> 
> What about restarting the failed module in case the issue was temporary 
> and environmental?

Something is wrong with your program internally if something like this 
happens. You can't expect a consistent program state. And most of the 
code in finally blocks was not written for such situations. You'll 
probably end up throwing another runtime error from within a finally block.

If you really want reliability, you should terminate the process 
immediately, and check the situation from another process.



More information about the Digitalmars-d mailing list