mirror of
https://github.com/boostorg/exception.git
synced 2025-07-13 12:36:37 +02:00
bug 5384
[SVN r70988]
This commit is contained in:
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/exception/get_error_info.hpp>
|
#include <boost/exception/get_error_info.hpp>
|
||||||
|
#include <boost/exception/info.hpp>
|
||||||
#include <boost/utility/enable_if.hpp>
|
#include <boost/utility/enable_if.hpp>
|
||||||
#ifndef BOOST_NO_RTTI
|
#ifndef BOOST_NO_RTTI
|
||||||
#include <boost/units/detail/utility.hpp>
|
#include <boost/units/detail/utility.hpp>
|
||||||
@ -85,19 +86,23 @@ boost
|
|||||||
char const *
|
char const *
|
||||||
get_diagnostic_information( exception const & x, char const * header )
|
get_diagnostic_information( exception const & x, char const * header )
|
||||||
{
|
{
|
||||||
if( error_info_container * c=x.data_.get() )
|
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
return c->diagnostic_information(header);
|
error_info_container * c=x.data_.get();
|
||||||
|
if( !c )
|
||||||
|
x.data_.adopt(c=new exception_detail::error_info_container_impl);
|
||||||
|
char const * di=c->diagnostic_information(header);
|
||||||
|
BOOST_ASSERT(di!=0);
|
||||||
|
return di;
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
@ -166,7 +171,10 @@ boost
|
|||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
(void) exception_detail::diagnostic_information_impl(&e,0,false);
|
(void) exception_detail::diagnostic_information_impl(&e,0,false);
|
||||||
return exception_detail::get_diagnostic_information(e,0);
|
if( char const * di=exception_detail::get_diagnostic_information(e,0) )
|
||||||
|
return di;
|
||||||
|
else
|
||||||
|
return "Failed to produce boost::diagnostic_information_what()";
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
}
|
}
|
||||||
catch(
|
catch(
|
||||||
|
@ -109,7 +109,6 @@ boost
|
|||||||
{
|
{
|
||||||
if( header )
|
if( header )
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(*header!=0);
|
|
||||||
std::ostringstream tmp;
|
std::ostringstream tmp;
|
||||||
tmp << header;
|
tmp << header;
|
||||||
for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i )
|
for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i )
|
||||||
|
@ -200,6 +200,17 @@ main()
|
|||||||
std::string di=current_exception_diagnostic_information();
|
std::string di=current_exception_diagnostic_information();
|
||||||
test3(di);
|
test3(di);
|
||||||
}
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
throw error4();
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
error4 & x )
|
||||||
|
{
|
||||||
|
std::string di1=boost::diagnostic_information(x);
|
||||||
|
std::string wh1=x.what();
|
||||||
|
BOOST_TEST(wh1==di1);
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
error4 x; x << tagged_int1(42) << tagged_int2(42);
|
error4 x; x << tagged_int1(42) << tagged_int2(42);
|
||||||
|
Reference in New Issue
Block a user