Generic C++ exception catch handler macro
In the catch block, you can rethrow the exception. This can be done in a function:

int rc = 0;
try{
// statements that can throw
}catch(...){
    HandleException(rc, "Extra info to append to logged exception message");
}



void HandleException(int rc, std::string msg)
{
    try{
        throw;
    }catch(Poco::Exception &amp;e){
        // ...
    }catch( const std::exception &amp;e){
        // ...
    }
}