Commit e562cc3f authored by Marco Bubke's avatar Marco Bubke

Sqlite: Cleanup exceptions

Change-Id: Id5ac7e6aba407eb5a3164bba57bff043e809beef
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent 3dcce060
......@@ -25,16 +25,12 @@
#include "sqliteexception.h"
#include <utils/smallstringio.h>
#include <QDebug>
namespace Sqlite {
SqliteException::SqliteException(const char *whatErrorHasHappen, const char *sqliteErrorMessage)
: m_whatErrorHasHappen(whatErrorHasHappen),
m_sqliteErrorMessage(sqliteErrorMessage)
{
}
void SqliteException::printWarning() const
{
if (!m_sqliteErrorMessage.isEmpty())
......
......@@ -27,20 +27,25 @@
#include "sqliteglobal.h"
#include <QByteArray>
#include <utils/smallstring.h>
namespace Sqlite {
class SQLITE_EXPORT SqliteException
{
public:
SqliteException(const char *m_whatErrorHasHappen, const char *sqliteErrorMessage = 0);
SqliteException(Utils::SmallString &&whatErrorHasHappen,
Utils::SmallString &&sqliteErrorMessage = Utils::SmallString())
: m_whatErrorHasHappen(std::move(whatErrorHasHappen)),
m_sqliteErrorMessage(std::move(sqliteErrorMessage))
{
}
void printWarning() const;
private:
const char *m_whatErrorHasHappen;
QByteArray m_sqliteErrorMessage;
Utils::SmallString m_whatErrorHasHappen;
Utils::SmallString m_sqliteErrorMessage;
};
} // namespace Sqlite
......@@ -27,9 +27,8 @@
namespace Sqlite {
SqlStatementBuilderException::SqlStatementBuilderException(const char *whatErrorHasHappen, const char *errorMessage)
: SqliteException(whatErrorHasHappen, errorMessage)
{
}
} // namespace Sqlite
......@@ -32,7 +32,7 @@ namespace Sqlite {
class SQLITE_EXPORT SqlStatementBuilderException : public SqliteException
{
public:
SqlStatementBuilderException(const char *m_whatErrorHasHappen, const char *errorMessage = 0);
using SqliteException::SqliteException;
};
} // namespace Sqlite
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment