mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-12 09:34:25 +01:00
db: 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. Changelog-None
This commit is contained in:
committed by
Rusty Russell
parent
9ebdb71ec0
commit
8309a049eb
@@ -146,6 +146,12 @@ static bool db_sqlite3_setup(struct db *db)
|
||||
}
|
||||
wrapper->conn = sql;
|
||||
|
||||
err = sqlite3_extended_result_codes(wrapper->conn, 1);
|
||||
if (err != SQLITE_OK) {
|
||||
db_fatal("failed to enable extended result codes: %s",
|
||||
sqlite3_errstr(err));
|
||||
}
|
||||
|
||||
if (!backup_filename)
|
||||
wrapper->backup_conn = NULL;
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user