Boost Exception

current_exception_diagnostic_information

#include <boost/exception/diagnostic_information.hpp> 

namespace
boost
    {
    std::string current_exception_diagnostic_information();
    }

Requirements:

This function must not be called outside of a catch block.

Returns:

If the current exception object can be converted to boost::exception or std::exception, this function returns the same string value returned by diagnostic_information for the current exception object. Otherwise, an unspecified non-empty string is returned.

Typical use is to call current_exception_diagnostic_information from a top-level function to output diagnostic information about unhandled exceptions:

int
main()
    {
    try
        {
        run_program();
        }
    catch(
    error & e )
        {
        //handle error
        }
    catch(
    ...)
        {
        std::cerr << "Unhandled exception!" << std::endl <<
            boost::current_exception_diagnostic_information();
        }
    }