# Boost Exception

### get_error_info

#include <boost/exception/get_error_info.hpp>

    namespace
    boost
        {
        template <class ErrorInfo,class E>
        shared_ptr<typename ErrorInfo::value_type const> get_error_info( E const & x );
        }

#### Requirements:

- ErrorInfo must be an instance of the error_info template.
- E must be polymorphic.
- The get_error_info function must not be called outside of a catch block.

#### Returns:

- If dynamic_cast<boost::exception const *>(&x) is 0, or if x does not store an object of type ErrorInfo, the returned value is an empty shared_ptr.
- Otherwise, the returned shared_ptr points to the stored value (use operator<< to store values in exception objects.) The shared_ptr is valid even after x has been destroyed.

#### Throws:

Nothing.

#### Note:

The interface of get_error_info may be affected by the build configuration macros.

### See Also:

BOOST_THROW_EXCEPTION
Boost Exception
boost/exception/get_error_info.hpp
Configuration Macros
error_info
exception