Boost.Test > Components > The Execution Monitor > boost::execution_exception
Boost Test logo

boost::execution_exception

The boost::execution exception is an exception used by the Execution Monitor to report problems detected during a monitored function run. It intentionally does not allocate any memory so as to be safe for use when there is a lack of memory.

class execution_exception {
public:
    execution_exception( error_code ec, const_string what_msg );

    enum error_code {
        cpp_exception_error,    // see note (1) below
        user_error,             // user reported nonfatal error
        system_error,           // see note (2) below
        timeout_error,          // only detectable on certain platforms
        user_fatal_error,       // user reported fatal error
        system_fatal_error      // see note (2) below
    };

    error_code   code() const;  // use this method to get an error code for the exception
    const_string what() const;  // use this method to get an error message for the exception
};

Note 1: Only uncaught C++ exceptions are treated as errors. If the application catches a C++ exception, this exception will never reach the Execution Monitor.

Note 2: These errors include UNIX signals and Windows structured exceptions. They are often initiated by hardware traps.

The implementation decides what is a fatal_system_exception and what is just a system_exception. Fatal errors are so likely to have corrupted machine state (like a stack overflow or addressing exception), so it is unreasonable to continue execution in this case.