mirror of
https://github.com/tnodir/fort
synced 2024-11-15 07:15:39 +00:00
UI: DbErrorManager: Debug some messages, not warn
This commit is contained in:
parent
8fda54d197
commit
499b861584
5
src/ui/3rdparty/sqlite/sqlitedb.cpp
vendored
5
src/ui/3rdparty/sqlite/sqlitedb.cpp
vendored
@ -677,6 +677,11 @@ bool SqliteDb::isIoError(int errCode)
|
||||
return qint8(errCode) == SQLITE_IOERR;
|
||||
}
|
||||
|
||||
bool SqliteDb::isDebugError(int errCode)
|
||||
{
|
||||
return qint8(errCode) == SQLITE_SCHEMA;
|
||||
}
|
||||
|
||||
bool SqliteDb::setErrorLogCallback(SQLITEDB_ERRORLOG_FUNC errorLogFunc, void *context)
|
||||
{
|
||||
return sqlite3_config(SQLITE_CONFIG_LOG, errorLogFunc, context) == SQLITE_OK;
|
||||
|
1
src/ui/3rdparty/sqlite/sqlitedb.h
vendored
1
src/ui/3rdparty/sqlite/sqlitedb.h
vendored
@ -125,6 +125,7 @@ public:
|
||||
SqliteStmt *stmt(const char *sql);
|
||||
|
||||
static bool isIoError(int errCode);
|
||||
static bool isDebugError(int errCode);
|
||||
|
||||
static bool setErrorLogCallback(SQLITEDB_ERRORLOG_FUNC errorLogFunc, void *context = nullptr);
|
||||
|
||||
|
@ -16,7 +16,14 @@ const QLoggingCategory LC("manager.dbError");
|
||||
|
||||
void sqliteLogHandler(void *context, int errCode, const char *message)
|
||||
{
|
||||
qCWarning(LC) << "Code:" << errCode << "Message:" << qUtf8Printable(message);
|
||||
const auto messageLine =
|
||||
QString("%1: %2").arg(QString::number(errCode), qUtf8Printable(message));
|
||||
|
||||
if (SqliteDb::isDebugError(errCode)) {
|
||||
qCDebug(LC) << messageLine;
|
||||
} else {
|
||||
qCWarning(LC) << messageLine;
|
||||
}
|
||||
|
||||
if (SqliteDb::isIoError(errCode)) {
|
||||
auto manager = static_cast<DbErrorManager *>(context);
|
||||
|
Loading…
Reference in New Issue
Block a user