...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Boost Exception provides a namespace-scope function diagnostic_information which takes a boost::exception. The returned string contains:
The returned string is not presentable as a friendly user message, but because it is generated automatically, it is useful for debugging or logging purposes. Here is an example:
#include <boost/exception.hpp> #include <iostream> void f(); //throws unknown types that derive from boost::exception. void g() { try { f(); } catch( boost::exception & e ) { std::cerr << diagnostic_information(e); } }