DIP33: A standard exception hierarchy - finally blocks not executed for Errors

Walter Bright newshound2 at digitalmars.com
Mon Apr 1 13:58:26 PDT 2013


On 4/1/2013 4:08 AM, Lars T. Kyllingstad wrote:
> It's time to clean up this mess.


As for why finally blocks are not executed for Error exceptions, the idea is to 
minimize cases where the original error would now cause an abort during the 
unwinding process. Catching an Error is useful for things like:

1. throw the whole plugin away and restart it
2. produce a log of what happened before aborting
3. engage the backup before aborting
4. alert the operator that the system has failed and why before aborting

Unwinding is not necessary for these, and can even get in the way by causing 
other failures and aborting the program by attempting cleanups when the code is 
in an invalid state.



More information about the Digitalmars-d mailing list