Make C Interface return stack.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-08-15 14:52:15 +02:00
parent f158dbf8a2
commit faaa4cdc9b
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 7 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include <cstring>
#include <exception>
#include <string>
#include "../src/Exception.hpp"
#define export extern "C"
#define ArbutilsException 3;
@ -12,6 +13,9 @@ class ExceptionHandler {
static std::string _ArbutilsLastException;
public:
static void SetLastException(const ArbUt::Exception& e) {
_ArbutilsLastException = std::string(e.what()) + "\n" + e.GetStacktrace();
}
static void SetLastException(const std::exception& e) { _ArbutilsLastException = std::string(e.what()); }
static const char* GetLastException() { return _ArbutilsLastException.c_str(); }
};
@ -20,6 +24,9 @@ public:
try { \
data; \
return 0; \
} catch (const ArbUt::Exception& e) { \
ExceptionHandler::SetLastException(e); \
return ArbutilsException; \
} catch (const std::exception& e) { \
ExceptionHandler::SetLastException(e); \
return ArbutilsException; \