From 9bab07e9bc8180171e61781ab83b89b96e15ff08 Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Tue, 5 Apr 2011 00:25:59 +0000 Subject: [PATCH] issue #5386 [SVN r70989] --- .../exception/diagnostic_information.hpp | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/include/boost/exception/diagnostic_information.hpp b/include/boost/exception/diagnostic_information.hpp index 2a14438..ef89d73 100644 --- a/include/boost/exception/diagnostic_information.hpp +++ b/include/boost/exception/diagnostic_information.hpp @@ -127,18 +127,26 @@ boost std::ostringstream tmp; if( be ) { - if( char const * const * f=get_error_info(*be) ) - { - tmp << *f; - if( int const * l=get_error_info(*be) ) - tmp << '(' << *l << "): "; - } - tmp << "Throw in function "; - if( char const * const * fn=get_error_info(*be) ) - tmp << *fn; + char const * const * f=get_error_info(*be); + int const * l=get_error_info(*be); + char const * const * fn=get_error_info(*be); + if( !f && !l && !fn ) + tmp << "Throw location unknown (consider using BOOST_THROW_EXCEPTION)\n"; else - tmp << "(unknown)"; - tmp << '\n'; + { + if( f ) + { + tmp << *f; + if( int const * l=get_error_info(*be) ) + tmp << '(' << *l << "): "; + } + tmp << "Throw in function "; + if( char const * const * fn=get_error_info(*be) ) + tmp << *fn; + else + tmp << "(unknown)"; + tmp << '\n'; + } } #ifndef BOOST_NO_RTTI tmp << std::string("Dynamic exception type: ") <<