Tweaks for exception handling.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#include "Core.hpp"
|
||||
|
||||
std::string ExceptionHandler::_creatureLibLastException = "";
|
||||
export const char* CreatureLib_C_GetLastException() { return ExceptionHandler::GetLastException(); }
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||
|
||||
class ExceptionHandler {
|
||||
static std::string _lastException;
|
||||
static std::string _creatureLibLastException;
|
||||
|
||||
public:
|
||||
static void SetLastException(std::string function, const std::exception& e) {
|
||||
std::stringstream ss;
|
||||
ss << "[" << function << "] " << e.what();
|
||||
_lastException = ss.str();
|
||||
_creatureLibLastException = ss.str();
|
||||
}
|
||||
static const char* GetLastException() { return _lastException.c_str(); }
|
||||
static const char* GetLastException() { return _creatureLibLastException.c_str(); }
|
||||
};
|
||||
|
||||
#define Try(data) \
|
||||
|
||||
Reference in New Issue
Block a user