light/modules/debug/include/ltdebug/assertions.hpp

27 lines
741 B
C++

#pragma once
#include <logger/logger.hpp>
namespace Light {
struct FailedAssertion: std::exception
{
FailedAssertion(const char *file, int line);
};
// OpenGL
struct glException: std::exception
{
glException(unsigned int source, unsigned int type, unsigned int id, const char *msg);
};
#define lt_assert(x, ...) \
{ \
if (!(x)) \
{ \
log_crt(__VA_ARGS__); \
throw ::Light::FailedAssertion(__FILE__, __LINE__); \
} \
}
} // namespace Light