From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2006-07-18 14:20:46
On 7/19/06, Jeremy Day <jeremy.day_at_[hidden]> wrote:
> With catch blocks the only recourse, so far as I can
> tell, is to basically copy-and-paste the catch code to each location where
> you need the exception handling code.
Not really... Instead of copy pasting, you can put it in a method or
class and use that handler where you need the exception handling to be
done. There are more creative ways and less brute way of handling
exceptions, without having to resort to MPL.
Whenever you see that the exception is being handled in *almost* the
same context, then perhaps you can design your solution so that you
handle that exception in a common location as well. It's more about
design than it actually is about just handling the exception per se.
While exceptions themselves allow you functionality to have interested
areas of code handle the exception, they also serve as control
structures for program state flaw in the face of exceptional instances
-- thus the term exception handling.
-- Dean Michael C. Berris C/C++ Software Architect Orange and Bronze Software Labs http://3w-agility.blogspot.com/ http://cplusplus-soup.blogspot.com/ Mobile: +639287291459 Email: dean [at] orangeandbronze [dot] com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk