Merge pull request #578 from gwenn/cant-open

Cant open
This commit is contained in:
gwenn
2019-10-19 11:20:56 +02:00
committed by GitHub
2 changed files with 22 additions and 2 deletions

View File

@@ -86,9 +86,14 @@ impl InnerConnection {
let db: *mut ffi::sqlite3 = db.assume_init();
if r != ffi::SQLITE_OK {
let e = if db.is_null() {
error_from_sqlite_code(r, None)
error_from_sqlite_code(r, Some(c_path.to_string_lossy().to_string()))
} else {
let e = error_from_handle(db, r);
let mut e = error_from_handle(db, r);
if let Error::SqliteFailure(
ffi::Error{code: ffi::ErrorCode::CannotOpen, extended_code: _}, Some(msg)) = e {
e = Error::SqliteFailure(
ffi::Error::new(r), Some(format!("{}: {}", msg, c_path.to_string_lossy())));
}
ffi::sqlite3_close(db);
e
};