Ejemplo n.º 1
0
 inline
 E const &
 operator<<( E const & x, error_info<Tag,T> const & v )
     {
     typedef error_info<Tag,T> error_info_tag_t;
     shared_ptr<error_info_tag_t> p( new error_info_tag_t(v) );
     exception_detail::error_info_container * c=x.data_.get();
     if( !c )
         x.data_.adopt(c=new exception_detail::error_info_container_impl);
     c->set(p,BOOST_EXCEPTION_STATIC_TYPEID(error_info_tag_t));
     return x;
     }
Ejemplo n.º 2
0
            static
            typename ErrorInfo::value_type *
            get( exception const & x )
                {
                if( exception_detail::error_info_container * c=x.data_.get() )
                    if( shared_ptr<exception_detail::error_info_base> eib = c->get(BOOST_EXCEPTION_STATIC_TYPEID(ErrorInfo)) )
                        {
#ifndef BOOST_NO_RTTI
                        BOOST_ASSERT( 0!=dynamic_cast<ErrorInfo *>(eib.get()) );
#endif
                        ErrorInfo * w = static_cast<ErrorInfo *>(eib.get());
                        return &w->value();
                        }
                return 0;
                }
Ejemplo n.º 3
0
{
	if (!data_.get())
		data_.adopt(new exception_detail::error_info_container_impl);

	if (auto b = dynamic_cast<const boost::exception_detail::error_info_container_impl*>(data_.get()))
		return reinterpret_cast<const BackdoorToErrorInfoMap::type*>(&b->info_);
	else
		return nullptr;
}
const error_info_map* get_error_info_map(const boost::exception& be)
{
	return be.get<BackdoorToErrorInfoMap>();
}

std::set<boost::exception_detail::type_info_> non_printing_error_types = {
	BOOST_EXCEPTION_STATIC_TYPEID(e_nt_status),
	BOOST_EXCEPTION_STATIC_TYPEID(e_last_error),
	BOOST_EXCEPTION_STATIC_TYPEID(boost::errinfo_api_function),
	BOOST_EXCEPTION_STATIC_TYPEID(boost::errinfo_nested_exception),
};

string diagnostic_information(const boost::exception& be)
{
	if (auto* info_ = get_error_info_map(be))
	{
		std::ostringstream ss;
		for (auto& kv : *info_)
		{
			auto& k = kv.first;
			auto& v = *kv.second;