Why exceptions for error handling is so important

via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 15 13:01:35 PST 2015


On Monday, 12 January 2015 at 20:53:04 UTC, Walter Bright wrote:
> On 1/12/2015 10:06 AM, Tobias Müller wrote:
> On Mon, Jan 12, 2015 at 05:22:26PM +0000, Adam D. Ruppe via 
> Digitalmars-d wrote:
>>> Yeah, exceptions are supposed to be ... well, *exceptions*, 
>>> rather than
>>> the norm. :-) If you're using exceptions to do flow control, 
>>> you're
>>> doing something wrong.
>>
>> But what's exceptional for you is normal for me.
>
> It's not a subjective truth, it's an objective fact.
>
> If code is throwing exceptions as part of its normal operation, 
> it is designed wrong.

But what this means that exceptions should only ever be used for 
catching programming errors, some kind of "soft" assertions.
It also means, that exceptions should only be thrown, but never 
be actually handled, because by handling it you would "admit" 
that it's actually normal operation.
This is not what I call error *handling*.


More information about the Digitalmars-d mailing list