minor diagnostic_information fix.

[SVN r48543]
This commit is contained in:
Emil Dotchevski
2008-09-02 18:44:05 +00:00
parent 31a9264bf9
commit 2887a719c8
3 changed files with 15 additions and 35 deletions

View File

@ -30,28 +30,6 @@ boost
} }
return 0; return 0;
} }
template <class T>
std::string
std_exception_diagnostic_information( std::exception const * x, T const & )
{
if( char const * s=x->what() )
if( *s )
return std::string("\nstd::exception::what(): ")+s;
return std::string();
}
template <class T>
std::string
std_exception_diagnostic_information( void const *, T const & e )
{
#ifndef BOOST_NO_RTTI
if( std::exception const * x=dynamic_cast<std::exception const *>(&e) )
return std_exception_diagnostic_information(x,e);
else
#endif
return std::string();
}
} }
inline inline
@ -61,8 +39,10 @@ boost
std::ostringstream tmp; std::ostringstream tmp;
tmp << tmp <<
"boost::exception diagnostic information:" "boost::exception diagnostic information:"
#if !defined(BOOST_NO_RTTI) && !defined(BOOST_NO_TYPEID) #ifndef BOOST_NO_RTTI
"\nDynamic exception type: " << BOOST_EXCEPTION_DYNAMIC_TYPEID(x).name() "\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 #endif
; ;
if( boost::shared_ptr<char const * const> f=get_error_info<throw_function>(x) ) if( boost::shared_ptr<char const * const> f=get_error_info<throw_function>(x) )