mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
feat(error): add assertion and error related functions
This commit is contained in:
parent
8f5fe40e05
commit
34980502b3
2 changed files with 90 additions and 0 deletions
28
storm/Error.hpp
Normal file
28
storm/Error.hpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef STORM_ERROR_HPP
|
||||
#define STORM_ERROR_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#if defined(NDEBUG)
|
||||
#define STORM_ASSERT(x) \
|
||||
if (!(x)) { \
|
||||
SErrSetLastError(0x57); \
|
||||
return 0; \
|
||||
}
|
||||
#else
|
||||
#define STORM_ASSERT(x) \
|
||||
if (!(x)) { \
|
||||
SErrPrepareAppFatal(__FILE__, __LINE__); \
|
||||
SErrDisplayAppFatal(#x); \
|
||||
}
|
||||
#endif
|
||||
|
||||
void SErrDisplayAppFatal(const char* format, ...);
|
||||
|
||||
int32_t SErrDisplayError(uint32_t errorcode, const char* filename, int32_t linenumber, const char* description, int32_t recoverable, uint32_t exitcode, uint32_t a7);
|
||||
|
||||
void SErrPrepareAppFatal(const char* filename, int32_t linenumber);
|
||||
|
||||
void SErrSetLastError(uint32_t errorcode);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue