Display the correct error message when we fail to open the sqlite3 db

fix #3290
This commit is contained in:
louiz’
2017-08-19 13:02:13 +02:00
parent 5b0b41f40a
commit 9648fd286c
+1 -1
View File
@@ -25,7 +25,7 @@ void Database::open(const std::string& filename)
auto res = sqlite3_open_v2(filename.data(), &new_db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr); auto res = sqlite3_open_v2(filename.data(), &new_db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr);
if (res != SQLITE_OK) if (res != SQLITE_OK)
{ {
log_error("Failed to open database file ", filename, ": ", sqlite3_errmsg(Database::db)); log_error("Failed to open database file ", filename, ": ", sqlite3_errmsg(new_db));
throw std::runtime_error(""); throw std::runtime_error("");
} }
Database::close(); Database::close();