virtual int function() { // here we perform some operation under monitoring that could throw my_exception if( m_argc < 2 ) throw my_exception1( 23 ); if( m_argc > 3 ) throw my_exception2( 45 ); else if( m_argc > 2 ) throw "too many args"; return 1; }
~exception_watcher1() { m_count1 = boost::log::aux::unhandled_exception_count(); try { exception_watcher2 watcher2(m_count2); throw my_exception2(); } catch (...) { } }