Rework of C Interface exception handler.
continuous-integration/drone/push Build is passing

This commit is contained in:
Deukhoofd committed 2020-07-26 16:30:00 +02:00
1 parent a4bb8864a0
commit 418d811d18
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
#include "Core.hpp"
std::string ExceptionHandler::_lastException = "";
char* ExceptionHandler::_lastException = 0;
export const char* CreatureLib_C_GetLastException() { return ExceptionHandler::GetLastException(); }
+3 -3
View File
@@ -9,11 +9,11 @@
#define CreatureLibException 1;
class ExceptionHandler {
static std::string _lastException;
static char* _lastException;
public:
static void SetLastException(const std::exception& e) { _lastException = std::string(e.what()); }
static const char* GetLastException() { return _lastException.c_str(); }
static void SetLastException(const std::exception& e) { _lastException = strcpy(_lastException, e.what()); }
static const char* GetLastException() { return _lastException; }
};
#define Try(data) \