mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
feat(storm): reorganized error library, assertions are now more detailed across different platforms; added new macros STORM_VALIDATE_STRING and STORM_PANIC
This commit is contained in:
parent
d149081f4e
commit
4f32840fdf
13 changed files with 164 additions and 103 deletions
|
|
@ -3,33 +3,8 @@
|
|||
|
||||
#include <cstdint>
|
||||
|
||||
#if defined(WHOA_SYSTEM_WIN)
|
||||
#include <WinError.h>
|
||||
#endif
|
||||
|
||||
#if defined(WHOA_SYSTEM_MAC) || defined(WHOA_SYSTEM_LINUX)
|
||||
#define ERROR_SUCCESS 0x0
|
||||
#define ERROR_INVALID_PARAMETER 0x57
|
||||
#endif
|
||||
|
||||
#if defined(NDEBUG)
|
||||
#define STORM_ASSERT(x) \
|
||||
(void)0
|
||||
#else
|
||||
#define STORM_ASSERT(x) \
|
||||
if (!(x)) { \
|
||||
SErrPrepareAppFatal(__FILE__, __LINE__); \
|
||||
SErrDisplayAppFatal(#x); \
|
||||
} \
|
||||
(void)0
|
||||
#endif
|
||||
|
||||
#define STORM_VALIDATE(x, y, ...) \
|
||||
if (!(x)) { \
|
||||
SErrSetLastError(y); \
|
||||
return __VA_ARGS__; \
|
||||
} \
|
||||
(void)0
|
||||
#include "storm/error/Macro.hpp"
|
||||
#include "storm/error/Codes.hpp"
|
||||
|
||||
[[noreturn]] void SErrDisplayAppFatal(const char* format, ...);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue