There's always the following information (iff you used BOOST_THROW_EXCEPTION
):
char const * const * f=get_error_info<throw_file>(*be);
int const * l=get_error_info<throw_line>(*be);
char const * const * fn=get_error_info<throw_function>(*be);
if( !f && !l && !fn )
tmp << "Throw location unknown (consider using BOOST_THROW_EXCEPTION)\n";
Other than that you have use the error_info_container
, but the data_
member is private¹.
If you are willing to "force" past that hurdle, the code to "duplicate" would not be so much:
char const *
diagnostic_information( char const * header ) const
{
if( header )
{
std::ostringstream tmp;
tmp << header;
for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i )
{
error_info_base const & x = *i->second;
tmp << x.name_value_string();
}
tmp.str().swap(diagnostic_info_str_);
}
return diagnostic_info_str_.c_str();
}
Everything there is undocumented, not part of the public API though: it lives in namespace boost::exception_detail
and the class boost::exception_detail::exception_info_container_impl
.
In short, there be dragons (these interfaces are subject to change without notice and can depend on surprising assumptions).
¹ (except on some older compilers).