aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/sqlite/sqliteexception.cpp
diff options
context:
space:
mode:
authorMarco Bubke <[email protected]>2024-03-18 11:46:21 +0100
committerMarco Bubke <[email protected]>2024-03-20 13:13:18 +0000
commit99def2c3377a81ee74f0503a9a94958d13fe211b (patch)
tree77ad2af2c3fdfc82a7fe2046207aa73677482beb /src/libs/sqlite/sqliteexception.cpp
parent1087375b28604498393d0c3bf8cf81947551765a (diff)
Sqlite: trace exceptions
That makes it easier to see what got wrong in the trace. So less debugging. Change-Id: I26ec3d6a6f81cbd20871260a2b32123343a20618 Reviewed-by: Qt CI Patch Build Bot <[email protected]> Reviewed-by: Tim Jenssen <[email protected]>
Diffstat (limited to 'src/libs/sqlite/sqliteexception.cpp')
-rw-r--r--src/libs/sqlite/sqliteexception.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/libs/sqlite/sqliteexception.cpp b/src/libs/sqlite/sqliteexception.cpp
index b5f581ad685..bb4a474adb0 100644
--- a/src/libs/sqlite/sqliteexception.cpp
+++ b/src/libs/sqlite/sqliteexception.cpp
@@ -3,14 +3,20 @@
#include "sqliteexception.h"
+#include "sqlitetracing.h"
+
#include <utils/smallstringio.h>
+#include <nanotrace/nanotracehr.h>
+
#include <sqlite.h>
#include <QDebug>
namespace Sqlite {
+using NanotraceHR::keyValue;
+
const char *Exception::what() const noexcept
{
return "Sqlite::Exception";
@@ -18,7 +24,10 @@ const char *Exception::what() const noexcept
const char *ExceptionWithMessage::what() const noexcept
{
- return "Sqlite::ExceptionWithMessage";
+ static Utils::SmallString text = Utils::SmallString::join(
+ {"Sqlite::ExceptionWithMessage", m_sqliteErrorMessage});
+
+ return text.data();
}
void ExceptionWithMessage::printWarning() const
@@ -26,6 +35,13 @@ void ExceptionWithMessage::printWarning() const
qWarning() << what() << m_sqliteErrorMessage;
}
+StatementIsBusy::StatementIsBusy(Utils::SmallString &&sqliteErrorMessage)
+ : ExceptionWithMessage{std::move(sqliteErrorMessage)}
+{
+ sqliteHighLevelCategory().threadEvent("StatementIsBusy"_t,
+ keyValue("error message", std::string_view{what()}));
+}
+
const char *StatementIsBusy::what() const noexcept
{
return "Sqlite::StatementIsBusy";
@@ -36,9 +52,19 @@ const char *DatabaseIsBusy::what() const noexcept
return "Sqlite::DatabaseIsBusy";
}
+StatementHasError::StatementHasError(Utils::SmallString &&sqliteErrorMessage)
+ : ExceptionWithMessage{std::move(sqliteErrorMessage)}
+{
+ sqliteHighLevelCategory().threadEvent("StatementHasError"_t,
+ keyValue("error message", std::string_view{what()}));
+}
+
const char *StatementHasError::what() const noexcept
{
- return "Sqlite::StatementHasError";
+ static Utils::SmallString text = Utils::SmallString::join(
+ {"Sqlite::StatementHasError: ", message()});
+
+ return text.data();
}
const char *StatementIsMisused::what() const noexcept