Boost logo

Boost :

From: Andreas Huber (spam2002_at_[hidden])
Date: 2002-08-19 12:22:23


Peter,

> Really, it seems to me that you are trying to use throw() and exceptions
as
> an assertion mechanism. Why? Can't you just use an assertion mechanism?
When
> the internal logic of the program has been compromised, exceptions are no
> longer appropriate. You just terminate the subprocess and respawn, right?

I think it is sometimes not appropriate to terminate right away when you run
into a program logic error. E.g. if you detect one during a customer
transaction in an ATM application you would want to _try_ returning the card
back to the customer before you terminate and restart. That's why I believe
the distinction between std::runtime_error and std::logic_error is actually
no so bad. By convention, you can catch a std::runtime_error anywhere and
attempt a remedy. A std::logic_error however must always lead to a program
exit, so you catch it only to perform important last-minute actions and
rethrow afterwards.

Andreas


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk