improved output from diagnostic_information()

[SVN r48604]
This commit is contained in:
Emil Dotchevski
2008-09-05 03:15:18 +00:00
parent d094c3f41c
commit 475dbd4021

View File

@ -38,23 +38,25 @@ boost
diagnostic_information( exception const & x ) diagnostic_information( exception const & x )
{ {
std::ostringstream tmp; std::ostringstream tmp;
tmp <<
"boost::exception diagnostic information:"
#ifndef BOOST_NO_RTTI
"\nDynamic exception type: " << BOOST_EXCEPTION_DYNAMIC_TYPEID(x).name();
if( std::exception const * e=dynamic_cast<std::exception const *>(&x) )
tmp << "\nstd::exception::what: " << e->what()
#endif
;
if( boost::shared_ptr<char const * const> f=get_error_info<throw_function>(x) )
tmp << "\nThrow function: " << *f;
if( boost::shared_ptr<char const * const> f=get_error_info<throw_file>(x) ) if( boost::shared_ptr<char const * const> f=get_error_info<throw_file>(x) )
tmp << "\nThrow file name: " << *f; {
if( boost::shared_ptr<int const> l=get_error_info<throw_line>(x) ) tmp << *f;
tmp << "\nThrow file line: " << *l; if( boost::shared_ptr<int const> l=get_error_info<throw_line>(x) )
tmp << '(' << *l << "): ";
}
tmp << "Throw in function ";
if( boost::shared_ptr<char const * const> fn=get_error_info<throw_function>(x) )
tmp << *fn;
else
tmp << "(unknown)";
#ifndef BOOST_NO_RTTI
tmp << "\nDynamic exception type: " << BOOST_EXCEPTION_DYNAMIC_TYPEID(x).name();
if( std::exception const * e=dynamic_cast<std::exception const *>(&x) )
tmp << "\nstd::exception::what: " << e->what();
#endif
if( char const * s=exception_detail::get_diagnostic_information(x) ) if( char const * s=exception_detail::get_diagnostic_information(x) )
if( *s ) if( *s )
tmp << "\n" << s; tmp << '\n' << s;
return tmp.str(); return tmp.str();
} }
} }