|
Zoltan2
|
Defines exception handling macros. More...
#include <stdexcept>#include <iostream>#include <sstream>#include <string>

Go to the source code of this file.
Defines | |
| #define | Z2_THROW_OUTSIDE_ERROR(env) |
| Throw an error returned from outside the Zoltan2 library. | |
| #define | Z2_FORWARD_EXCEPTIONS |
| Forward an exception back through call stack. | |
| #define | Z2_THROW_EXPERIMENTAL(mystr) |
| Throw an error when experimental code is requested but not compiled. | |
| #define | Z2_THROW_EXPERIMENTAL_WOLF(mystr) |
| Throw an error when wolf experimental code is requested but not compiled. | |
| #define | Z2_ASSERT_VALUE(actual, expected) |
| Throw an error when actual value is not equal to expected value. | |
| #define | __func__zoltan2__ __func__ |
Defines exception handling macros.
Definition in file Zoltan2_Exceptions.hpp.
| #define Z2_THROW_OUTSIDE_ERROR | ( | env | ) |
catch (std::exception &e) { \ std::cerr<<(env).myRank_<<" "<<__FILE__<<","<<__LINE__<<","<<e.what()<<std::endl; \ throw e; \ }
Throw an error returned from outside the Zoltan2 library.
A try block that calls another library should be followed by this catch block. The error message if any is printed and the exception is then thrown.
Definition at line 64 of file Zoltan2_Exceptions.hpp.
| #define Z2_FORWARD_EXCEPTIONS |
catch (std::runtime_error &e) { throw e; } \ catch (std::logic_error &e) { throw e; } \ catch (std::bad_alloc &e) { throw e; } \ catch (std::exception &e) { throw e; }
Forward an exception back through call stack.
A try block that calls another Zoltan2 function should be followed by this catch series. It ensures that the original runtime, logic or bad_alloc exception gets passed up. For example, if a runtime_error is caught as a std::exception, it gets passed up as a std::exception and the what() message is not lost.
Definition at line 80 of file Zoltan2_Exceptions.hpp.
| #define Z2_THROW_EXPERIMENTAL | ( | mystr | ) |
{ \
std::ostringstream oss; \
oss << (mystr) << std::endl \
<< "To experiment with this software, configure with " \
<< "-D Zoltan2_ENABLE_Experimental:BOOL=ON " \
<< std::endl; \
throw std::runtime_error(oss.str()); \
}
Throw an error when experimental code is requested but not compiled.
Experimental code must be enabled with CMAKE Option -D Zoltan2_ENABLE_Experimental:BOOL=ON If it is not enabled but it is called, throw an exception. The input string mystr is a use-specific message included in the throw message.
Definition at line 95 of file Zoltan2_Exceptions.hpp.
| #define Z2_THROW_EXPERIMENTAL_WOLF | ( | mystr | ) |
{ \
std::ostringstream oss; \
oss << (mystr) << std::endl \
<< "To experiment with this software, configure with " \
<< "-D Zoltan2_ENABLE_Experimental_Wolf:BOOL=ON " \
<< std::endl; \
throw std::runtime_error(oss.str()); \
}
Throw an error when wolf experimental code is requested but not compiled.
Experimental code must be enabled with CMAKE Option -D Zoltan2_ENABLE_Experimental_Wolf:BOOL=ON If it is not enabled but it is called, throw an exception. The input string mystr is a use-specific message included in the throw message.
Definition at line 114 of file Zoltan2_Exceptions.hpp.
| #define Z2_ASSERT_VALUE | ( | actual, | |
| expected | |||
| ) |
{ \
if (actual != expected) \
{ \
std::ostringstream oss; \
oss << "Expected value " << expected << "does not match actual value"\
<< actual << "in" << __FILE__<<", "<<__LINE__ \
<< std::endl; \
throw std::runtime_error(oss.str()); \
}\
}
Throw an error when actual value is not equal to expected value.
Check if the two arguments passed are equal and throw a runtime error if they are not.
Definition at line 130 of file Zoltan2_Exceptions.hpp.
| #define __func__zoltan2__ __func__ |
Definition at line 149 of file Zoltan2_Exceptions.hpp.
1.7.6.1