inherit exception for CppSQLite3Exception (#1544)

catch any exception just in case exception isnt inherited from
This commit is contained in:
David Markowitz 2024-04-10 05:32:54 -07:00 committed by GitHub
parent d067a8d12f
commit b8b2b687e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -120,6 +120,8 @@ void CatchUnhandled(int sig) {
if (eptr) std::rethrow_exception(eptr); if (eptr) std::rethrow_exception(eptr);
} catch(const std::exception& e) { } catch(const std::exception& e) {
LOG("Caught exception: '%s'", e.what()); LOG("Caught exception: '%s'", e.what());
} catch (...) {
LOG("Caught unknown exception.");
} }
#ifndef INCLUDE_BACKTRACE #ifndef INCLUDE_BACKTRACE

View File

@ -36,10 +36,11 @@
#include "sqlite3.h" #include "sqlite3.h"
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <exception>
#define CPPSQLITE_ERROR 1000 #define CPPSQLITE_ERROR 1000
class CppSQLite3Exception class CppSQLite3Exception : public std::exception
{ {
public: public:
@ -55,6 +56,8 @@ public:
const char* errorMessage() { return mpszErrMess; } const char* errorMessage() { return mpszErrMess; }
const char* what() const noexcept override { return mpszErrMess; }
static const char* errorCodeAsString(int nErrCode); static const char* errorCodeAsString(int nErrCode);
private: private: