mirror of
https://github.com/boostorg/exception.git
synced 2025-07-15 05:26:32 +02:00
New function: diagnostic_information_what.
[SVN r56448]
This commit is contained in:
@ -41,6 +41,7 @@ boost
|
|||||||
<div class="RenoPageList"><a href="boost_exception_all_hpp.html">boost/exception/all.hpp<br/>
|
<div class="RenoPageList"><a href="boost_exception_all_hpp.html">boost/exception/all.hpp<br/>
|
||||||
</a><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information<br/>
|
</a><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information<br/>
|
||||||
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
||||||
|
</a><a href="diagnostic_information_what.html">diagnostic_information_what<br/>
|
||||||
</a><a href="synopsis.html">Synopsis<br/>
|
</a><a href="synopsis.html">Synopsis<br/>
|
||||||
</a></div>
|
</a></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -78,6 +78,7 @@ std::exception::what: example_io error
|
|||||||
</a><a href="configuration_macros.html">Configuration Macros<br/>
|
</a><a href="configuration_macros.html">Configuration Macros<br/>
|
||||||
</a><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information<br/>
|
</a><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information<br/>
|
||||||
</a><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
</a><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
||||||
|
</a><a href="diagnostic_information_what.html">diagnostic_information_what<br/>
|
||||||
</a><a href="frequently_asked_questions.html">Frequently Asked Questions<br/>
|
</a><a href="frequently_asked_questions.html">Frequently Asked Questions<br/>
|
||||||
</a><a href="motivation.html">Motivation<br/>
|
</a><a href="motivation.html">Motivation<br/>
|
||||||
</a><a href="throw_exception.html">throw_exception<br/>
|
</a><a href="throw_exception.html">throw_exception<br/>
|
||||||
|
56
doc/diagnostic_information_what.html
Normal file
56
doc/diagnostic_information_what.html
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
|
||||||
|
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
|
||||||
|
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
|
||||||
|
<title>diagnostic_information_what</title>
|
||||||
|
<link href='reno.css' type='text/css' rel='stylesheet'/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="body-0">
|
||||||
|
<div class="body-1">
|
||||||
|
<div class="body-2">
|
||||||
|
<div>
|
||||||
|
<div id="boost_logo">
|
||||||
|
<a href="http://www.boost.org"><img style="border:0" src="../../../boost.png" alt="Boost" width="277" height="86"/></a>
|
||||||
|
</div>
|
||||||
|
<h1>Boost Exception</h1>
|
||||||
|
</div>
|
||||||
|
<!-- Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||||
|
<!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
|
||||||
|
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
||||||
|
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>diagnostic_information_what</h3>
|
||||||
|
</div>
|
||||||
|
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="boost_exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp</a></span>><span class="RenoBR"> </span><br/></p>
|
||||||
|
<pre>namespace
|
||||||
|
boost
|
||||||
|
{
|
||||||
|
<span class="RenoIncludeSPAN"> char const * <span class="RenoLink">diagnostic_information_what</span>( boost::<span class="RenoLink"><a href="exception.html">exception</a></span> const & e ) throw();</span>
|
||||||
|
}</pre>
|
||||||
|
</div><p>The <span class="RenoLink">diagnostic_information_what</span> function is intended to be called from a user-defined std::exception::what() override. This allows diagnostic information to be returned as the what() string.</p>
|
||||||
|
<h4>Returns:</h4>
|
||||||
|
<p>A pointer to a zero-terminated buffer that contains a string similar to the std::string returned by the <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span> function, or null to indicate a failure.</p>
|
||||||
|
<h4>Throws:</h4>
|
||||||
|
<p>Nothing.</p>
|
||||||
|
<h4>Note:</h4>
|
||||||
|
<p>The returned pointer becomes invalid if any <span class="RenoLink"><a href="error_info.html">error_info</a></span> is modified or added to the exception object, or if another diagnostic information function is called.</p>
|
||||||
|
</div><div class="RenoAutoDIV"></div>
|
||||||
|
<div class="RenoAutoDIV"></div>
|
||||||
|
<!-- Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||||
|
<!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
|
||||||
|
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
||||||
|
<div id="footer">
|
||||||
|
<p> </p>
|
||||||
|
<hr/>
|
||||||
|
<p>
|
||||||
|
<a class="logo" href="http://jigsaw.w3.org/css-validator/check/referer"><img class="logo_pic" src="valid-css.png" alt="Valid CSS" height="31" width="88"/></a>
|
||||||
|
<a class="logo" href="http://validator.w3.org/check?uri=referer"><img class="logo_pic" src="valid-xhtml.png" alt="Valid XHTML 1.0" height="31" width="88"/></a>
|
||||||
|
<small>Copyright (c) 2006-2009 by Emil Dotchevski and Reverge Studios, Inc.<br/>
|
||||||
|
Distributed under the <a href="http://www.boost.org/LICENSE_1_0.txt">Boost Software License, Version 1.0</a>.</small>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -76,6 +76,7 @@ typedef boost::<span class="RenoLink">error_info</span><struct tag_errno,int&
|
|||||||
</a><a href="boost_exception_exception_hpp.html">boost/exception/exception.hpp<br/>
|
</a><a href="boost_exception_exception_hpp.html">boost/exception/exception.hpp<br/>
|
||||||
</a><a href="boost_exception_info_hpp.html">boost/exception/info.hpp<br/>
|
</a><a href="boost_exception_info_hpp.html">boost/exception/info.hpp<br/>
|
||||||
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
||||||
|
</a><a href="diagnostic_information_what.html">diagnostic_information_what<br/>
|
||||||
</a><a href="error_info_error_info.html">error_info::error_info<br/>
|
</a><a href="error_info_error_info.html">error_info::error_info<br/>
|
||||||
</a><a href="error_info_value.html">error_info::value<br/>
|
</a><a href="error_info_value.html">error_info::value<br/>
|
||||||
</a><a href="error_info_value_type.html">error_info::value_type<br/>
|
</a><a href="error_info_value_type.html">error_info::value_type<br/>
|
||||||
|
@ -48,6 +48,7 @@ boost
|
|||||||
</a><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information<br/>
|
</a><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information<br/>
|
||||||
</a><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
</a><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
||||||
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
||||||
|
</a><a href="diagnostic_information_what.html">diagnostic_information_what<br/>
|
||||||
</a><a href="exception_types_as_simple_semantic_tags.html">Exception Types as Simple Semantic Tags<br/>
|
</a><a href="exception_types_as_simple_semantic_tags.html">Exception Types as Simple Semantic Tags<br/>
|
||||||
</a><a href="enable_current_exception.html">enable_current_exception<br/>
|
</a><a href="enable_current_exception.html">enable_current_exception<br/>
|
||||||
</a><a href="enable_error_info.html">enable_error_info<br/>
|
</a><a href="enable_error_info.html">enable_error_info<br/>
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
<p><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information</a></p>
|
<p><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information</a></p>
|
||||||
<h3>d</h3>
|
<h3>d</h3>
|
||||||
<p><a href="diagnostic_information.html">diagnostic_information</a></p>
|
<p><a href="diagnostic_information.html">diagnostic_information</a></p>
|
||||||
|
<p><a href="diagnostic_information_what.html">diagnostic_information_what</a></p>
|
||||||
<h3>e</h3>
|
<h3>e</h3>
|
||||||
<p><a href="enable_current_exception.html">enable_current_exception</a></p>
|
<p><a href="enable_current_exception.html">enable_current_exception</a></p>
|
||||||
<p><a href="enable_error_info.html">enable_error_info</a></p>
|
<p><a href="enable_error_info.html">enable_error_info</a></p>
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
<p><a href="tutorial_diagnostic_information.html">Diagnostic Information</a></p>
|
<p><a href="tutorial_diagnostic_information.html">Diagnostic Information</a></p>
|
||||||
<h3>d</h3>
|
<h3>d</h3>
|
||||||
<p><a href="diagnostic_information.html">diagnostic_information</a></p>
|
<p><a href="diagnostic_information.html">diagnostic_information</a></p>
|
||||||
|
<p><a href="diagnostic_information_what.html">diagnostic_information_what</a></p>
|
||||||
<h3>E</h3>
|
<h3>E</h3>
|
||||||
<p><a href="exception_types_as_simple_semantic_tags.html">Exception Types as Simple Semantic Tags</a></p>
|
<p><a href="exception_types_as_simple_semantic_tags.html">Exception Types as Simple Semantic Tags</a></p>
|
||||||
<h3>e</h3>
|
<h3>e</h3>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -44,14 +44,14 @@ boost
|
|||||||
|
|
||||||
inline
|
inline
|
||||||
char const *
|
char const *
|
||||||
get_diagnostic_information( exception const & x )
|
get_diagnostic_information( exception const & x, char const * header )
|
||||||
{
|
{
|
||||||
if( error_info_container * c=x.data_.get() )
|
if( error_info_container * c=x.data_.get() )
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
return c->diagnostic_information();
|
return c->diagnostic_information(header);
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
@ -63,7 +63,7 @@ boost
|
|||||||
|
|
||||||
inline
|
inline
|
||||||
std::string
|
std::string
|
||||||
diagnostic_information_impl( boost::exception const * be, std::exception const * se )
|
diagnostic_information_impl( boost::exception const * be, std::exception const * se, bool with_what )
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(be||se);
|
BOOST_ASSERT(be||se);
|
||||||
#ifndef BOOST_NO_RTTI
|
#ifndef BOOST_NO_RTTI
|
||||||
@ -72,6 +72,13 @@ boost
|
|||||||
if( !be )
|
if( !be )
|
||||||
be = dynamic_cast<boost::exception const *>(se);
|
be = dynamic_cast<boost::exception const *>(se);
|
||||||
#endif
|
#endif
|
||||||
|
char const * wh=0;
|
||||||
|
if( with_what && se )
|
||||||
|
{
|
||||||
|
wh=se->what();
|
||||||
|
if( be && exception_detail::get_diagnostic_information(*be,0)==wh )
|
||||||
|
return wh;
|
||||||
|
}
|
||||||
std::ostringstream tmp;
|
std::ostringstream tmp;
|
||||||
if( be )
|
if( be )
|
||||||
{
|
{
|
||||||
@ -92,12 +99,12 @@ boost
|
|||||||
tmp << std::string("Dynamic exception type: ") <<
|
tmp << std::string("Dynamic exception type: ") <<
|
||||||
(be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).name() << '\n';
|
(be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).name() << '\n';
|
||||||
#endif
|
#endif
|
||||||
if( se )
|
if( with_what && se )
|
||||||
tmp << "std::exception::what: " << se->what() << '\n';
|
tmp << "std::exception::what: " << wh << '\n';
|
||||||
if( be )
|
if( be )
|
||||||
if( char const * s=exception_detail::get_diagnostic_information(*be) )
|
if( char const * s=exception_detail::get_diagnostic_information(*be,tmp.str().c_str()) )
|
||||||
if( *s )
|
if( *s )
|
||||||
tmp << s;
|
return s;
|
||||||
return tmp.str();
|
return tmp.str();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,7 +114,7 @@ boost
|
|||||||
typename enable_if<exception_detail::enable_boost_exception_overload<T>,std::string>::type
|
typename enable_if<exception_detail::enable_boost_exception_overload<T>,std::string>::type
|
||||||
diagnostic_information( T const & e )
|
diagnostic_information( T const & e )
|
||||||
{
|
{
|
||||||
return exception_detail::diagnostic_information_impl(&e,0);
|
return exception_detail::diagnostic_information_impl(&e,0,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@ -115,7 +122,28 @@ boost
|
|||||||
typename enable_if<exception_detail::enable_std_exception_overload<T>,std::string>::type
|
typename enable_if<exception_detail::enable_std_exception_overload<T>,std::string>::type
|
||||||
diagnostic_information( T const & e )
|
diagnostic_information( T const & e )
|
||||||
{
|
{
|
||||||
return exception_detail::diagnostic_information_impl(0,&e);
|
return exception_detail::diagnostic_information_impl(0,&e,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
char const *
|
||||||
|
diagnostic_information_what( exception const & e ) throw()
|
||||||
|
{
|
||||||
|
char const * w=0;
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
|
try
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
(void) exception_detail::diagnostic_information_impl(&e,0,false);
|
||||||
|
return exception_detail::get_diagnostic_information(e,0);
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
... )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +159,7 @@ boost
|
|||||||
boost::exception const * be=current_exception_cast<boost::exception const>();
|
boost::exception const * be=current_exception_cast<boost::exception const>();
|
||||||
std::exception const * se=current_exception_cast<std::exception const>();
|
std::exception const * se=current_exception_cast<std::exception const>();
|
||||||
if( be || se )
|
if( be || se )
|
||||||
return exception_detail::diagnostic_information_impl(be,se);
|
return exception_detail::diagnostic_information_impl(be,se,true);
|
||||||
else
|
else
|
||||||
return "No diagnostic information available.";
|
return "No diagnostic information available.";
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ boost
|
|||||||
struct
|
struct
|
||||||
error_info_container
|
error_info_container
|
||||||
{
|
{
|
||||||
virtual char const * diagnostic_information() const = 0;
|
virtual char const * diagnostic_information( char const * ) const = 0;
|
||||||
virtual shared_ptr<error_info_base> get( type_info_ const & ) const = 0;
|
virtual shared_ptr<error_info_base> get( type_info_ const & ) const = 0;
|
||||||
virtual void set( shared_ptr<error_info_base> const &, type_info_ const & ) = 0;
|
virtual void set( shared_ptr<error_info_base> const &, type_info_ const & ) = 0;
|
||||||
virtual void add_ref() const = 0;
|
virtual void add_ref() const = 0;
|
||||||
@ -169,7 +169,7 @@ boost
|
|||||||
template <>
|
template <>
|
||||||
struct get_info<throw_line>;
|
struct get_info<throw_line>;
|
||||||
|
|
||||||
char const * get_diagnostic_information( exception const & );
|
char const * get_diagnostic_information( exception const &, char const * );
|
||||||
}
|
}
|
||||||
|
|
||||||
class
|
class
|
||||||
@ -231,7 +231,7 @@ boost
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend char const * exception_detail::get_diagnostic_information( exception const & );
|
friend char const * exception_detail::get_diagnostic_information( exception const &, char const * );
|
||||||
|
|
||||||
template <class E,class Tag,class T>
|
template <class E,class Tag,class T>
|
||||||
friend E const & operator<<( E const &, error_info<Tag,T> const & );
|
friend E const & operator<<( E const &, error_info<Tag,T> const & );
|
||||||
|
@ -98,11 +98,13 @@ boost
|
|||||||
}
|
}
|
||||||
|
|
||||||
char const *
|
char const *
|
||||||
diagnostic_information() const
|
diagnostic_information( char const * header ) const
|
||||||
{
|
{
|
||||||
if( diagnostic_info_str_.empty() )
|
if( header )
|
||||||
{
|
{
|
||||||
|
BOOST_ASSERT(*header!=0);
|
||||||
std::ostringstream tmp;
|
std::ostringstream tmp;
|
||||||
|
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 )
|
||||||
{
|
{
|
||||||
shared_ptr<error_info_base const> const & x = i->second;
|
shared_ptr<error_info_base const> const & x = i->second;
|
||||||
|
@ -43,6 +43,29 @@ error2:
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct
|
||||||
|
error3:
|
||||||
|
std::exception
|
||||||
|
{
|
||||||
|
char const *
|
||||||
|
what() const throw()
|
||||||
|
{
|
||||||
|
return "error3";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct
|
||||||
|
error4:
|
||||||
|
std::exception,
|
||||||
|
boost::exception
|
||||||
|
{
|
||||||
|
char const *
|
||||||
|
what() const throw()
|
||||||
|
{
|
||||||
|
return diagnostic_information_what(*this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
test1( std::string const & di1, std::string const & di2 )
|
test1( std::string const & di1, std::string const & di2 )
|
||||||
{
|
{
|
||||||
@ -75,6 +98,33 @@ test2( std::string const & di1, std::string const & di2 )
|
|||||||
BOOST_TEST(di2.find("bad value")!=std::string::npos);
|
BOOST_TEST(di2.find("bad value")!=std::string::npos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
test3( std::string const & di )
|
||||||
|
{
|
||||||
|
#ifndef BOOST_NO_RTTI
|
||||||
|
BOOST_TEST(di.find("type:")!=std::string::npos);
|
||||||
|
#endif
|
||||||
|
BOOST_TEST(di.find("error3")!=std::string::npos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
test4( std::string const & di1, std::string const & di2 )
|
||||||
|
{
|
||||||
|
BOOST_TEST( di1!=di2 );
|
||||||
|
#ifndef BOOST_NO_RTTI
|
||||||
|
BOOST_TEST(di1.find("type:")!=std::string::npos);
|
||||||
|
#endif
|
||||||
|
BOOST_TEST(di1.find("test_tag1")!=std::string::npos);
|
||||||
|
BOOST_TEST(di1.find("test_tag2")!=std::string::npos);
|
||||||
|
BOOST_TEST(di1.find("fourty-two")!=std::string::npos);
|
||||||
|
#ifndef BOOST_NO_RTTI
|
||||||
|
BOOST_TEST(di2.find("type:")!=std::string::npos);
|
||||||
|
#endif
|
||||||
|
BOOST_TEST(di2.find("test_tag1")!=std::string::npos);
|
||||||
|
BOOST_TEST(di2.find("test_tag2")!=std::string::npos);
|
||||||
|
BOOST_TEST(di2.find("bad value")!=std::string::npos);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
@ -131,9 +181,58 @@ main()
|
|||||||
error2 & x )
|
error2 & x )
|
||||||
{
|
{
|
||||||
std::string di1 = current_exception_diagnostic_information();
|
std::string di1 = current_exception_diagnostic_information();
|
||||||
|
BOOST_TEST(di1==boost::diagnostic_information_what(x));
|
||||||
x << tagged_int1(2) << tagged_int2(2);
|
x << tagged_int1(2) << tagged_int2(2);
|
||||||
std::string di2 = current_exception_diagnostic_information();
|
std::string di2 = current_exception_diagnostic_information();
|
||||||
|
BOOST_TEST(di2==boost::diagnostic_information_what(x));
|
||||||
test2(di1,di2);
|
test2(di1,di2);
|
||||||
}
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
error3 x;
|
||||||
|
std::string di=diagnostic_information(x);
|
||||||
|
test3(di);
|
||||||
|
throw x;
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
... )
|
||||||
|
{
|
||||||
|
std::string di=current_exception_diagnostic_information();
|
||||||
|
test3(di);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
error4 x; x << tagged_int1(42) << tagged_int2(42);
|
||||||
|
throw x;
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
error4 & x )
|
||||||
|
{
|
||||||
|
std::string di1=boost::diagnostic_information(x);
|
||||||
|
std::string wh1=x.what();
|
||||||
|
BOOST_TEST(wh1==di1);
|
||||||
|
x << tagged_int1(2) << tagged_int2(2);
|
||||||
|
std::string di2 = diagnostic_information(x);
|
||||||
|
std::string wh2=x.what();
|
||||||
|
BOOST_TEST(wh2==di2);
|
||||||
|
test4(di1,di2);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
error4 x; x << tagged_int1(42) << tagged_int2(42);
|
||||||
|
throw x;
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
error4 & x )
|
||||||
|
{
|
||||||
|
std::string di1=boost::current_exception_diagnostic_information();
|
||||||
|
std::string wh1=x.what();
|
||||||
|
BOOST_TEST(wh1==di1);
|
||||||
|
x << tagged_int1(2) << tagged_int2(2);
|
||||||
|
std::string di2 = current_exception_diagnostic_information();
|
||||||
|
std::string wh2=x.what();
|
||||||
|
BOOST_TEST(wh2==di2);
|
||||||
|
test4(di1,di2);
|
||||||
|
}
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user