Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Class execution_exception

boost::execution_exception — This class is used to report any kind of an failure during execution of a monitored function inside of execution_monitor.


// In header: <boost/test/execution_monitor.hpp>

class execution_exception {
  // member classes/structs/unions

  // Simple model for the location of failure in a source code.

  struct location {
    // construct/copy/destruct
    explicit location(char const * = 0, size_t = 0, char const * = 0);
    explicit location(const_string, size_t = 0, char const * = 0);

    // public data members
    const_string m_file_name;    // File name. 
    size_t m_line_num;    // Line number. 
    const_string m_function;    // Function name. 
  enum error_code;
  // construct/copy/destruct
  execution_exception(error_code, const_string, location const &);


The instance of this class is thrown out of execution_monitor::execute invocation when failure is detected. Regardless of a kind of failure occurred the instance will provide a uniform way to catch and report it.

One important design rationale for this class is that we should be ready to work after fatal memory corruptions or out of memory conditions. To facilitate this class never allocates any memory and assumes that strings it refers to are either some constants or live in a some kind of persistent (preallocated) memory.

execution_exception public construct/copy/destruct

  1. execution_exception(error_code ec, const_string what_msg, 
                        location const & location);
    Constructs instance based on message, location and error code.



    error code


    error location


    error message