Boost logo

Boost :

From: Oleg Abrosimov (beholder_at_[hidden])
Date: 2006-07-18 22:39:50


Hello Jeremy!

You've come in the right place and in the right time.
Your code is _very_ useful and is a great step forward in exception
handling techniques. See my previous post with [system] in it's subject.

after posting it I've thought further and caught the idea to use visitor
pattern to handle exceptions in type-safe, re-usable and manageable way.
but I've had no idea of how to implement it in current C++. So your code
is very welcomed. put it in the vault section (you can find it on the
main boost page) please.

in filesystem error handling it can be used uniformly to handle errors
in both cases where exception or additional parameter to indicate error
is used:

class my_exception_handler {...};

try {
   call_filesystem_lib(...);
} catch(...) {
   catcher(my_exception_handler());
}

or

call_filesystem_lib(..., my_exception_handler());
//Note no error code is required

Best,
Oleg Abrosimov.

Jeremy Day wrote:
> On 7/18/06, Sohail Somani <s.somani_at_[hidden]> wrote:
>> I just don't see the point, except as an academic exercise
>
>
> The point is partly academic, as I am working on learning MPL. However, I
> think that this technique, or some derivation thereof, can help make code
> more maintainable, since you can reuse my_exception_handler whenever you
> want to handle the same exception in the same way, even though you catch it
> in a different place. 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.
>
> Jeremy
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


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