mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
feat(error): improve error macros
This commit is contained in:
parent
e5fe4a7e19
commit
e3b0c356ad
2 changed files with 17 additions and 19 deletions
|
|
@ -12,17 +12,7 @@
|
|||
#endif
|
||||
|
||||
#if defined(NDEBUG)
|
||||
#define STORM_ASSERT(x) \
|
||||
if (!(x)) { \
|
||||
SErrSetLastError(ERROR_INVALID_PARAMETER); \
|
||||
return 0; \
|
||||
} \
|
||||
(void)0
|
||||
#define STORM_ASSERT_VOID(x) \
|
||||
if (!(x)) { \
|
||||
SErrSetLastError(ERROR_INVALID_PARAMETER); \
|
||||
return; \
|
||||
} \
|
||||
#define STORM_ASSERT(x) \
|
||||
(void)0
|
||||
#else
|
||||
#define STORM_ASSERT(x) \
|
||||
|
|
@ -31,13 +21,14 @@
|
|||
SErrDisplayAppFatal(#x); \
|
||||
} \
|
||||
(void)0
|
||||
#define STORM_ASSERT_VOID(x) \
|
||||
#endif
|
||||
|
||||
#define STORM_VALIDATE(x, y, ...) \
|
||||
if (!(x)) { \
|
||||
SErrPrepareAppFatal(__FILE__, __LINE__); \
|
||||
SErrDisplayAppFatal(#x); \
|
||||
SErrSetLastError(y); \
|
||||
return __VA_ARGS__; \
|
||||
} \
|
||||
(void)0
|
||||
#endif
|
||||
|
||||
[[noreturn]] void SErrDisplayAppFatal(const char* format, ...);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue