HPX - High Performance ParalleX

PrevUpHomeNext

Macro HPX_THROW_EXCEPTION

HPX_THROW_EXCEPTION — Throw a hpx::exception initialized from the given parameters.

Synopsis

// In header: <hpx/exception.hpp>

HPX_THROW_EXCEPTION(errcode, f, msg)

Description

The macro HPX_THROW_EXCEPTION can be used to throw a hpx::exception. The purpose of this macro is to prepend the source file name and line number of the position where the exception is thrown to the error message. Moreover, this associates additional diagnostic information with the exception, such as file name and line number, locality id and thread id, and stack backtrace from the point where the exception was thrown.

The parameter errcode holds the hpx::error code the new exception should encapsulate. The parameter f is expected to hold the name of the function exception is thrown from and the parameter msg holds the error message the new exception should encapsulate.

Example: 

void raise_exception()
{
    // Throw a hpx::exception initialized from the given parameters.
    // Additionally associate with this exception some detailed
    // diagnostic information about the throw-site.
    HPX_THROW_EXCEPTION(hpx::no_success, "raise_exception", "simulated error");
}


PrevUpHomeNext