diff options
| author | Glenn Smith <glenn@vector35.com> | 2023-09-01 00:28:41 -0400 |
|---|---|---|
| committer | Alexander Taylor <ajtaylor@fuzyll.com> | 2023-09-01 13:18:59 -0400 |
| commit | 3a2115bcdcfbca0432afad84f4877187f72514a2 (patch) | |
| tree | c33d689280b37e2c04d6f655d6ea66e4adc26fbd /binaryninjaapi.h | |
| parent | 9cc14bb1edbd111530ee1e936fe5e59de9450832 (diff) | |
Make asserts from jsoncpp more descriptive
Diffstat (limited to 'binaryninjaapi.h')
| -rw-r--r-- | binaryninjaapi.h | 88 |
1 files changed, 1 insertions, 87 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index d0d86bbd..404651c7 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -42,6 +42,7 @@ #include <optional> #include <memory> #include "binaryninjacore.h" +#include "exceptions.h" #include "json/json.h" #ifdef _MSC_VER @@ -1679,93 +1680,6 @@ namespace BinaryNinja { std::map<std::string, uint64_t> GetMemoryUsageInfo(); - struct ExceptionWithStackTrace : std::exception - { - std::string m_originalMessage; - std::string m_message; - std::string m_stackTrace; - ExceptionWithStackTrace(const std::string& message) - { - m_originalMessage = message; - m_message = message; - if (getenv("BN_DEBUG_EXCEPTION_TRACES")) - { - char* stackTrace = BNGetCurrentStackTraceString(); - if (stackTrace) - { - m_stackTrace = stackTrace; - m_message += "\n"; - m_message += stackTrace; - BNFreeString(stackTrace); - } - } - } - ExceptionWithStackTrace(std::exception_ptr exc1, std::exception_ptr exc2) - { - m_originalMessage = ""; - m_message = ""; - if (exc1) - { - try - { - std::rethrow_exception(exc1); - } - catch (ExceptionWithStackTrace& stacky) - { - m_originalMessage = stacky.m_originalMessage; - m_message = stacky.m_message; - } - catch (std::exception& exc) - { - m_originalMessage = exc.what(); - m_message = exc.what(); - } - catch (...) - { - m_originalMessage = "Some unknown exception"; - m_message = "Some unknown exception"; - } - } - if (exc2) - { - try - { - std::rethrow_exception(exc2); - } - catch (ExceptionWithStackTrace& stacky) - { - m_originalMessage += "\n" + stacky.m_originalMessage; - m_message += "\n" + stacky.m_message; - } - catch (std::exception& exc) - { - m_originalMessage = exc.what(); - m_message = exc.what(); - } - catch (...) - { - m_originalMessage = "Some unknown exception"; - m_message = "Some unknown exception"; - } - } - if (getenv("BN_DEBUG_EXCEPTION_TRACES")) - { - char* stackTrace = BNGetCurrentStackTraceString(); - if (stackTrace) - { - m_stackTrace = stackTrace; - m_message += "\n"; - m_message += stackTrace; - BNFreeString(stackTrace); - } - } - } - const char* what() const noexcept override - { - return m_message.c_str(); - } - }; - /*! \ingroup databuffer */ |
