Make C Interface return stack.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
f158dbf8a2
commit
faaa4cdc9b
|
@ -4,6 +4,7 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "../src/Exception.hpp"
|
||||||
#define export extern "C"
|
#define export extern "C"
|
||||||
|
|
||||||
#define ArbutilsException 3;
|
#define ArbutilsException 3;
|
||||||
|
@ -12,6 +13,9 @@ class ExceptionHandler {
|
||||||
static std::string _ArbutilsLastException;
|
static std::string _ArbutilsLastException;
|
||||||
|
|
||||||
public:
|
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 void SetLastException(const std::exception& e) { _ArbutilsLastException = std::string(e.what()); }
|
||||||
static const char* GetLastException() { return _ArbutilsLastException.c_str(); }
|
static const char* GetLastException() { return _ArbutilsLastException.c_str(); }
|
||||||
};
|
};
|
||||||
|
@ -20,6 +24,9 @@ public:
|
||||||
try { \
|
try { \
|
||||||
data; \
|
data; \
|
||||||
return 0; \
|
return 0; \
|
||||||
|
} catch (const ArbUt::Exception& e) { \
|
||||||
|
ExceptionHandler::SetLastException(e); \
|
||||||
|
return ArbutilsException; \
|
||||||
} catch (const std::exception& e) { \
|
} catch (const std::exception& e) { \
|
||||||
ExceptionHandler::SetLastException(e); \
|
ExceptionHandler::SetLastException(e); \
|
||||||
return ArbutilsException; \
|
return ArbutilsException; \
|
||||||
|
|
Loading…
Reference in New Issue