Fix error handling in open database procedure

When opening a database fails a proper error message is now shown which
hopefully tells the user what the source of the problem is. Note: this
will only work for newer versions of SQLite.

This requires a bug fix which is included in this commit. The error
message wasn't taken from the correct database handle, so it had nothing
to do with the actual error source. This is fixed by this commit as
well.
This commit is contained in:
Martin Kleusberg
2017-01-15 21:10:23 +01:00
parent fa81c0b1e3
commit 1a6c34951b
2 changed files with 12 additions and 5 deletions

View File

@@ -307,7 +307,7 @@ bool MainWindow::fileOpen(const QString& fileName, bool dontAddToRecentFiles, bo
loadPragmas();
retval = true;
} else {
QMessageBox::warning(this, qApp->applicationName(), tr("Invalid file format."));
QMessageBox::warning(this, qApp->applicationName(), tr("Could not open database file.\nReason: %1").arg(db.lastErrorMessage));
return false;
}
}