diff --git a/include/boost/exception/diagnostic_information.hpp b/include/boost/exception/diagnostic_information.hpp index d248b0c..99273bc 100644 --- a/include/boost/exception/diagnostic_information.hpp +++ b/include/boost/exception/diagnostic_information.hpp @@ -38,23 +38,25 @@ boost diagnostic_information( exception const & x ) { 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(&x) ) - tmp << "\nstd::exception::what: " << e->what() -#endif - ; - if( boost::shared_ptr f=get_error_info(x) ) - tmp << "\nThrow function: " << *f; if( boost::shared_ptr f=get_error_info(x) ) - tmp << "\nThrow file name: " << *f; - if( boost::shared_ptr l=get_error_info(x) ) - tmp << "\nThrow file line: " << *l; + { + tmp << *f; + if( boost::shared_ptr l=get_error_info(x) ) + tmp << '(' << *l << "): "; + } + tmp << "Throw in function "; + if( boost::shared_ptr fn=get_error_info(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(&x) ) + tmp << "\nstd::exception::what: " << e->what(); +#endif if( char const * s=exception_detail::get_diagnostic_information(x) ) if( *s ) - tmp << "\n" << s; + tmp << '\n' << s; return tmp.str(); } }