14#ifdef NF_WITH_MPI_SUPPORT
32[[noreturn]]
void logFatal(
const std::string& message);
52 explicit NeoNException(
const std::string& message) : message_(message) {}
58 const char*
what() const noexcept
override {
return message_.c_str(); }
74#define NF_ERROR_MESSAGE(message) \
75 "Error: " << message << "\nFile: " << __FILE__ << "\nLine: " << __LINE__ << "\n"
90#define NF_ERROR_EXIT(message) \
91 NeoN::Logging::detail::logFatal((std::stringstream() << NF_ERROR_MESSAGE(message)).str())
103#define NF_THROW(message) \
104 throw NeoN::NeoNException((std::stringstream() << NF_ERROR_MESSAGE(std::string(message))).str())
118#define NF_ASSERT(condition, message) \
121 if (!(condition)) [[unlikely]] \
124 "Assertion `" #condition " in " << __FILE__ << ":" << __LINE__ \
125 << "` failed.\n " << message \
144#define NF_ASSERT_THROW(condition, message) \
147 if (!(condition)) [[unlikely]] \
149 NF_THROW("Assertion `" #condition "` failed.\n " << message); \
165#define NF_DEBUG_ASSERT(condition, message) NF_ASSERT(condition, message)
178#define NF_DEBUG_ASSERT_THROW(condition, message) NF_ASSERT_THROW(condition, message)
190#define NF_DEBUG_ASSERT(condition, message) ((void)0)
203#define NF_DEBUG_ASSERT_THROW(condition, message) ((void)0)
218#define NF_ASSERT_EQUAL(a, b) NF_ASSERT(a == b, "Expected " << b << ", got " << a)
230#define NF_DEBUG_ASSERT_EQUAL(a, b) NF_DEBUG_ASSERT(a == b, "Expected " << b << ", got " << a)
245#define NF_ASSERT_EQUAL_THROW(a, b) NF_ASSERT_THROW(a == b, "Expected " << b << ", got " << a)
257#define NF_DEBUG_ASSERT_EQUAL_THROW(a, b) \
258 NF_DEBUG_ASSERT_THROW(a == b, "Expected " << b << ", got " << a)
Custom exception class for NeoN.
const char * what() const noexcept override
Returns the error message associated with the exception.
NeoNException(const std::string &message)
Constructs a NeoNException object with the given error message.
void logFatal(const std::string &message)
Integer types used throughout NeoN.