diff --git a/CInterface/Core.hpp b/CInterface/Core.hpp index 3a2d0c7..7acd1fc 100644 --- a/CInterface/Core.hpp +++ b/CInterface/Core.hpp @@ -4,6 +4,7 @@ #include #include #include +#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; \