diagnostic_information

# Boost Exception

### diagnostic_information

#include <boost/exception/diagnostic_information.hpp>

    namespace
    boost
        {
        std::string diagnostic_information( boost::exception const & );
        }

#### Returns:

This function returns a string value that is automatically composed from the string representations of all error_info objects stored in a boost::exception through operator<<, along with other diagnostic information relevant to the exception.

The string representation of each error_info object is deduced by a function call that is bound at the time the error_info<Tag,T> template is instantiated. The following overload resolutions are attempted in order:

1. Unqualified call to to_string(x), where x is of type error_info<Tag,T> (the return value is expected to be of type std::string.)
2. Unqualified call to to_string(x.value()) (the return value is expected to be of type std::string.)
3. Unqualified call to s << x.value(), where s is a std::ostringstream.

The first successfully bound function is used at the time diagnostic_information is called; if all 3 overload resolutions are unsuccessful, the system is unable to convert the error_info object to string, and an unspecified stub string value is used without issuing a compile error.

#### Notes:

- The format of the returned string is unspecified.
- The returned string is not user-friendly.
- If dynamic_cast<std::exception const *>(&x) is not null, the returned string includes the output from std::exception::what.
- The returned string may include additional platform-specific diagnostic information.

#### Example:

this is a possible output from the diagnostic_information function, as used in libs/exception/example/example_io.cpp:

    libs\exception\example\example_io.cpp(83): Throw in function class boost::shared_ptr<struct _iobuf> __cdecl my_fopen(const char *,const char *)
    Dynamic exception type: class boost::exception_detail::clone_impl<class fopen_error>
    std::exception::what: example_io error
    [struct tag_errno *] = 2, OS says "No such file or directory"
    [struct tag_file_name *] = tmp1.txt
    [struct tag_function *] = fopen
    [struct tag_open_mode *] = rb

### See Also:

BOOST_THROW_EXCEPTION
Boost Exception
boost/exception/diagnostic_information.hpp
Diagnostic Information