Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "Core.hpp"
|
||||
|
||||
std::string ExceptionHandler::_creatureLibLastException = "";
|
||||
std::string ExceptionHandler::_creatureLibLastExceptionStacktrace = "";
|
||||
std::string ExceptionHandler::_creatureLibLastExceptionStacktrace = "Unset";
|
||||
|
||||
export const char* CreatureLib_C_GetLastException() { return ExceptionHandler::GetLastException(); }
|
||||
export const char* CreatureLib_C_GetLastExceptionStacktrace() { return ExceptionHandler::GetLastExceptionStacktrace(); }
|
||||
|
||||
@@ -21,11 +21,14 @@ public:
|
||||
ss << "[" << function << "] " << e.what();
|
||||
_creatureLibLastException = ss.str();
|
||||
_creatureLibLastExceptionStacktrace = e.GetStacktrace(depth, true);
|
||||
if (_creatureLibLastExceptionStacktrace.empty())
|
||||
_creatureLibLastExceptionStacktrace = "err";
|
||||
}
|
||||
static void SetLastException(const std::string& function, const std::exception& e) {
|
||||
std::stringstream ss;
|
||||
ss << "[" << function << "] " << e.what();
|
||||
_creatureLibLastException = ss.str();
|
||||
_creatureLibLastExceptionStacktrace = "Exception did not have a stacktrace.";
|
||||
}
|
||||
static const char* GetLastException() { return _creatureLibLastException.c_str(); }
|
||||
static const char* GetLastExceptionStacktrace() { return _creatureLibLastExceptionStacktrace.c_str(); }
|
||||
|
||||
Reference in New Issue
Block a user