Boost logo

Boost :

From: Alex Besogonov (cyberax_at_[hidden])
Date: 2005-10-07 05:13:46

Hello, world!

Today I was browsing RSDN (Russian Software Developer Network) forums
and found a great trick for exception handling
void TheFunction()
     try {
     } catch(...) {

void ExceptionFilter()
     try {
     } catch(Exception1 const& e) {
         //Blah-blah 1
     } catch(Exception2 const& e) {
         //Blah-blah 2
     } catch(Exception3 const& e) {
         //Blah-blah 3
     } catch(Exception4 const& e) {
         //Blah-blah 4
     } catch(Exception5 const& e) {
         throw; //Just rethrow
     } catch(...) {
         //Something other

It turns out that this trick is explicitly permitted by the Standard (as
it was pointed in this post:

I think this trick can be really helpful in conjunction with Boost.Bind.

It would be great to write something like this:
boost::function<void()> func=
If SomeObj::func1 throws an exception then logging_filter will write it
into the application's log and suppress its further propagation.

Or another use-case:
com_error_translator will translate exceptions from Microsoft's
_com_error to something like std::runtime_error.

With respect,
		Alex Besogonov(cyberax_at_[hidden])

Boost list run by bdawes at, gregod at, cpdaniel at, john at