mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
wallet: enable SQLite extended result codes
With this change, we get more fine-grained error messages if something goes wrong in the course of communicating with the SQLite database. To pick some random examples, the error codes SQLITE_IOERR_NOMEM, SQLITE_IOERR_CORRUPTFS or SQLITE_IOERR_FSYNC are way more specific than just a plain SQLITE_IOERR, and the corresponding error messages generated by sqlite3_errstr() will hence give a better hint to the user (or also to the developers, if an error report is sent) what the cause for a failure is.
This commit is contained in:
parent
f036c35e51
commit
90be29c5b5
@ -212,6 +212,10 @@ void SQLiteDatabase::Open()
|
||||
if (ret != SQLITE_OK) {
|
||||
throw std::runtime_error(strprintf("SQLiteDatabase: Failed to open database: %s\n", sqlite3_errstr(ret)));
|
||||
}
|
||||
ret = sqlite3_extended_result_codes(m_db, 1);
|
||||
if (ret != SQLITE_OK) {
|
||||
throw std::runtime_error(strprintf("SQLiteDatabase: Failed to enable extended result codes: %s\n", sqlite3_errstr(ret)));
|
||||
}
|
||||
}
|
||||
|
||||
if (sqlite3_db_readonly(m_db, "main") != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user