Boost Exception

exception

#include <boost/exception/exception.hpp>

namespace
boost
    {
    class
    exception
        {
        public:
    
        virtual char const * diagnostic_information() const throw();    
        virtual char const * what() const throw();    
    
        protected:
    
        exception();
        exception( exception const & x );    
        ~exception();    
        };
    }

Class boost::exception is designed to be used as a universal base for user-defined exception types.

An object of any type deriving from boost::exception can store data of arbitrary types, using the error_info wrapper and operator<<.

To retrieve data from a boost::exception object, use the get_error_info function template.

exception::exception

exception();
exception( exception const & x );

Effects:

  • Default constructor: initializes an empty boost::exception object.
  • Copy constructor: initializes a boost::exception object which shares with x all data added through operator<<, including data that is added at a future time.

Throws:

Nothing.

exception::~exception

Effects:

Frees all resources associated with a boost::exception object.

Throws:

Nothing.

exception::diagnostic_information

virtual char const * diagnostic_information() const throw();

Returns:

An string representation of all data stored in the boost::exception object by the operator<< function. See "Tutorial: Diagnostic Information" for details.

Throws:

Nothing.

Note:

The return value remains valid until the exception object from which it is obtained is destroyed or modified.

exception::what

virtual char const * what() const throw();

Returns:

The default implementation is equivalent to return exception::diagnostic_information(). The signature of boost::exception::what is identical to the familiar std::exception::what function, so that when an exception type that derives both std::exception and boost::exception overrides the what function, it overrides both std::exception::what and boost::exception::what.

Throws:

Nothing.

Note:

The return value remains valid until the exception object from which it is obtained is destroyed or modified.

See also: