Home

mike3 wrote:

>> http://*/SWtesting/FAQs/FAQs012.asp
>
> It says about making "liberal use of exception handlers". But
> 've also heard something where that having too many exception
> handlers all over the place isn't necessarily a good thing.

Tip: Read /Exceptional C++/ by Herb Sutter.

Here's a list of generic "don'ts":

- don't duplicate code all over, even catch() statements
- don't just catch everything, write it to a log and keep going
- don't catch(...)
- don't write any error handling code without developer-tests
(use a mock object if you can't force the target error!)
- don't let your users invoke untested error-handling code!
- don't allow uncaught exceptions
- don't use exception specifiers ("void foo() throw(whatever);")

Put them together, and you _catch_ exceptions liberally, but you don't
_write_ catch statements liberally. You design them carefully like any
other code.

The most important Do there is, "At exception time, roll your state back to
its condition before the user entered their last input, or equivalent.
Don't leave a dangling state." This advice matches our main homeboy, James
Kanze's, recent pronouncement that RAII refers to more than just leakable
resources.

And a block closure system works wonders there, too... (-;

--
Phlip

previous
next

udp, datagram sockets
Re: database persistence with mysql, sqlite
SOAPpy Error
Getting the size of Class
Re: Coding Standards
Domki w Rowach
rzeczoznawca majątkowy
tatralandia
opony.24chorzy.net
Projekty wnętrz Kraków