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:
phaneron 2024-08-30 18:04:21 -04:00
parent d149081f4e
commit 4f32840fdf
13 changed files with 164 additions and 103 deletions

View file

@ -1,9 +1,11 @@
#include "storm/Error.hpp"
#include "storm/error/Error.cpp"
#include <windows.h>
#include <cstdarg>
#include <cstdlib>
#include <string>
#include <windows.h>
std::string errorf(const char *format, ...) {
va_list args;
@ -26,24 +28,6 @@ std::string errorf(const char *format, ...) {
}
}
[[noreturn]] void SErrDisplayAppFatal(const char* format, ...) {
// Format arguments
constexpr size_t size = 1024;
char buffer[size] = {0};
va_list args;
va_start(args, format);
vsnprintf(buffer, size, format, args);
va_end(args);
// Print formatted message to debugger
OutputDebugString(buffer);
// Display error to GUI
MessageBox(nullptr, buffer, "Fatal error!", MB_ICONERROR);
exit(EXIT_FAILURE);
}
int32_t SErrDisplayError(uint32_t errorcode, const char* filename, int32_t linenumber, const char* description, int32_t recoverable, uint32_t exitcode, uint32_t a7) {
std::string s = "";
s.reserve(1024);