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 <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; \
|
||||
|
|
Loading…
Reference in New Issue