enforce()?
Simen kjaeraas
simen.kjaras at gmail.com
Thu Jun 17 01:58:44 PDT 2010
Lutger <lutger.blijdestijn at gmail.com> wrote:
>> How did you end up with an email system that is so horribly broken that
>> it spits Errors instead of Exceptions when things are not quite the way
>> it wants them to be?
>
> Not Errors, it is not in D and does not distinguish between Errors and
> Exceptions. It was an example, a (design) question. It's very simple:
Ah. Then no, handling the exception is perfectly acceptable, and probably
the right thing to do.
>> Basically, throwing an Exception means 'Your attention please, reactor 5
>> has a cooling problem you might want to look at', whereas an Error means
>> 'Explosion imminent, get the fuck off outta here!'.
>>
>
> No, an Error means the program has a bug. Programs have thousands of
> bugs, this
> is not related to how critical it is. An Exception can be way more
> important to
> fix than a bug. WebServerDownException for example, is often not a bug
> in the
> code that drives websites, but for sure I will contact the sysadmin
> before even
> thinking of going back to work. The question is how to proceed after the
> fact.
Yes and no. Throwing an error puts the program into an undefined state,
and everything may happen. Because everything happening at once would
strain space-time and cause Bad Things™ to happen, we would like to limit
the time in which this does occur. Hence, we bail out.
That said, a bug in a rarely-used function may indeed be significantly
less important than getting a server back online. However, I would still
say an error indicates something is fundamentally wrong.
--
Simen
More information about the Digitalmars-d
mailing list