Exception/Error division in D

deadalnix deadalnix at gmail.com
Wed May 30 01:37:06 PDT 2012


Le 29/05/2012 18:53, Sean Kelly a écrit :
> On May 24, 2012, at 11:50 PM, Jacob Carlborg wrote:
>
>> On 2012-05-24 21:33, Sean Kelly wrote:
>>
>>> This is a good point.  OutOfMemory conditions aside, the only time I'd want to recover from an Error condition was at the point the event occurred, not somewhere up the stack.
>>
>> You never feel you want to catch at the top level, print a sensible error message and then exit the application? Instead of the application just disappearing for user.
>
> Well sure, but I wouldn't consider this recovery.

As said, recovery isn't the only point of exceptions. For problems as 
bad as this, you often want to fail cleanly, eventually print an error 
message or something.

Exception handling discussion are often very focussed on recovery, but 
the fact is that it is A use case, but not THE use case.

It is very common in real case that you cannot recover from some 
problems, and just want to fail without messing everything up.


More information about the Digitalmars-d mailing list