Files
2026-10-23 16:13:31 +00:00

22 lines
1.7 KiB
C++

#pragma once
#include "ddkit/utils/Logger.hpp"
#include <signal.h>
#define DDKIT_THROW_ON_FALSE(cond) \
if (!(cond)) { \
/*raise(SIGTRAP); */ \
std::string msg = std::string("Assertion \"" #cond "\" failed in ") + __FILE__ + ":" + std::to_string(__LINE__); \
ddkit::log::fatal() << msg; \
throw std::logic_error(msg); \
}
#define DDKIT_THROW_ON_FALSE_INFO(cond, info) \
if (!(cond)) { \
/*raise(SIGTRAP);*/ \
std::string msg = std::string("Assertion \"" #cond "\" failed in ") + __FILE__ + ":" + std::to_string(__LINE__); \
ddkit::log::fatal() << msg << " :" << std::string(info); \
throw std::logic_error(msg + " :" + std::string(info)); \
}