HPX_THROW_EXCEPTION, HPX_THROW_BAD_ALLOC, HPX_THROWS_IF
HPX_THROW_EXCEPTION, HPX_THROW_BAD_ALLOC, HPX_THROWS_IF#
Defined in header hpx/exception.hpp.
See Public API for a list of names and headers that are part of the public HPX API.
Defines
-
HPX_THROW_EXCEPTION(errcode, f, ...)#
Throw a hpx::exception initialized from the given parameters.
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 parameterf
is expected to hold the name of the function exception is thrown from and the parametermsg
holds the error message the new exception should encapsulate.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::error::no_success, "raise_exception", "simulated error"); }
- Example:
-
HPX_THROW_BAD_ALLOC(f)#
Throw a hpx::bad_alloc_exception initialized from the given parameters.
The macro HPX_THROW_BAD_ALLOC 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 parameterf
is expected to hold the name of the function exception is thrown from and the parametermsg
holds the error message the new exception should encapsulate.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_BAD_ALLOC("raise_exception", "simulated error"); }
- Example:
-
HPX_THROWS_IF(ec, errcode, f, ...)#
Either throw a hpx::exception or initialize hpx::error_code from the given parameters.
The macro HPX_THROWS_IF can be used to either throw a hpx::exception or to initialize a hpx::error_code from the given parameters. If &ec == &hpx::throws, the semantics of this macro are equivalent to HPX_THROW_EXCEPTION. If &ec != &hpx::throws, the hpx::error_code instance
ec
is initialized instead.The parameter
errcode
holds the hpx::error code from which the new exception should be initialized. The parameterf
is expected to hold the name of the function exception is thrown from and the parametermsg
holds the error message the new exception should encapsulate.
-
HPX_THROWS_BAD_ALLOC_IF(ec, f)#
Either throw a hpx::bad_alloc_exception or hpx::error_code to out_of_memory.
The macro HPX_THROWS_BAD_ALLOC_IF can be used to either throw a hpx::bad_alloc_exception or to initialize a hpx::error_code to hpx::error::out_of_memory. If &ec == &hpx::throws, the semantics of this macro are equivalent to HPX_THROW_BAD_ALLOC. If &ec != &hpx::throws, the hpx::error_code instance
ec
is initialized instead.
-
namespace hpx