From b8b2b687e24617e131e85d1f4171840cc0d268c5 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Wed, 10 Apr 2024 05:32:54 -0700 Subject: [PATCH] inherit exception for CppSQLite3Exception (#1544) catch any exception just in case exception isnt inherited from --- dCommon/Diagnostics.cpp | 2 ++ thirdparty/SQLite/CppSQLite3.h | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dCommon/Diagnostics.cpp b/dCommon/Diagnostics.cpp index 46c17e43..2ed27fef 100644 --- a/dCommon/Diagnostics.cpp +++ b/dCommon/Diagnostics.cpp @@ -120,6 +120,8 @@ void CatchUnhandled(int sig) { if (eptr) std::rethrow_exception(eptr); } catch(const std::exception& e) { LOG("Caught exception: '%s'", e.what()); + } catch (...) { + LOG("Caught unknown exception."); } #ifndef INCLUDE_BACKTRACE diff --git a/thirdparty/SQLite/CppSQLite3.h b/thirdparty/SQLite/CppSQLite3.h index 7ae8a8b7..70c4b8e8 100644 --- a/thirdparty/SQLite/CppSQLite3.h +++ b/thirdparty/SQLite/CppSQLite3.h @@ -36,10 +36,11 @@ #include "sqlite3.h" #include #include +#include #define CPPSQLITE_ERROR 1000 -class CppSQLite3Exception +class CppSQLite3Exception : public std::exception { public: @@ -54,6 +55,8 @@ public: const int errorCode() { return mnErrCode; } const char* errorMessage() { return mpszErrMess; } + + const char* what() const noexcept override { return mpszErrMess; } static const char* errorCodeAsString(int nErrCode);