feat(error): implement error suppression behavior

This commit is contained in:
Adam Heinermann 2026-01-03 15:39:31 -08:00 committed by fallenoak
parent 9c2fc0adf4
commit b69feaca30
4 changed files with 25 additions and 5 deletions

View file

@ -1,5 +1,6 @@
if(WHOA_TEST_STORMDLL)
# Note: Error excluded because some functions take more args than expected by older Storms
set(TEST_SOURCES
Big.cpp
Core.cpp

14
test/Error.cpp Normal file
View file

@ -0,0 +1,14 @@
#include "test/Test.hpp"
#include "storm/Error.hpp"
TEST_CASE("SErrDisplayError", "[event]") {
SECTION("does nothing if errors are suppressed") {
uint32_t errorcode = GENERATE(0, STORM_ERROR_ASSERTION, ERROR_INVALID_PARAMETER);
int32_t recoverable = GENERATE(0, 1);
uint32_t exitcode = GENERATE(0, 1);
uint32_t unkarg = GENERATE(0, 1, 0x11111111);
SErrSuppressErrors(1);
CHECK_FALSE(SErrDisplayError(errorcode, nullptr, 0, nullptr, recoverable, exitcode, unkarg));
}
}

View file

@ -36,7 +36,7 @@ void STORMAPI SBigToUnsigned(BigData*, uint32_t*) {}
#include <storm/Error.hpp>
void STORMCDECL SErrDisplayAppFatal(const char* format, ...) {}
int32_t STORMAPI SErrDisplayError(uint32_t, const char*, int32_t, const char*, int32_t, uint32_t, uint32_t) { return 0; }
int32_t STORMAPI SErrDisplayError(uint32_t, const char*, int32_t, const char*, int32_t, uint32_t) { return 0; }
int32_t STORMCDECL SErrDisplayErrorFmt(uint32_t, const char*, int32_t, int32_t, uint32_t, const char*, ...) { return 0; }
void STORMAPI SErrPrepareAppFatal(const char*, int32_t) {}
void STORMAPI SErrSetLastError(uint32_t) {}