Sqlite: Derive Sqlite::Exception from std::exception

Change-Id: I11a1162e5b450f71b8c2c4068ace6ef08825d7bb
Reviewed-by: Michael Winkelmann <michael.winkelmann@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2020-05-14 16:41:18 +02:00
committed by Tim Jenssen
parent 33a833d187
commit ebbb88b11a

View File

@@ -29,19 +29,21 @@
#include <utils/smallstring.h> #include <utils/smallstring.h>
#include <exception>
#include <iostream> #include <iostream>
namespace Sqlite { namespace Sqlite {
class SQLITE_EXPORT Exception class SQLITE_EXPORT Exception : public std::exception
{ {
public: public:
Exception(const char *whatErrorHasHappen, Exception(const char *whatErrorHasHappen,
Utils::SmallString &&sqliteErrorMessage = Utils::SmallString()) Utils::SmallString &&sqliteErrorMessage = Utils::SmallString())
: m_whatErrorHasHappen(whatErrorHasHappen), : m_whatErrorHasHappen(whatErrorHasHappen)
m_sqliteErrorMessage(std::move(sqliteErrorMessage)) , m_sqliteErrorMessage(std::move(sqliteErrorMessage))
{ {}
}
const char *what() const noexcept override { return m_sqliteErrorMessage.data(); }
void printWarning() const; void printWarning() const;