mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 00:39:20 +08:00
Fix error messages when failing to convert paths and strings to C-compatible versions
This commit is contained in:
parent
992f01f03b
commit
1af3fcd053
@ -128,14 +128,14 @@ impl SqliteError {
|
|||||||
fn str_to_cstring(s: &str) -> SqliteResult<CString> {
|
fn str_to_cstring(s: &str) -> SqliteResult<CString> {
|
||||||
CString::new(s).map_err(|_| SqliteError{
|
CString::new(s).map_err(|_| SqliteError{
|
||||||
code: ffi::SQLITE_MISUSE,
|
code: ffi::SQLITE_MISUSE,
|
||||||
message: "Could not convert path to C-combatible string".to_string()
|
message: format!("Could not convert string {} to C-combatible string", s),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn path_to_cstring(p: &Path) -> SqliteResult<CString> {
|
fn path_to_cstring(p: &Path) -> SqliteResult<CString> {
|
||||||
let s = try!(p.to_str().ok_or(SqliteError{
|
let s = try!(p.to_str().ok_or(SqliteError{
|
||||||
code: ffi::SQLITE_MISUSE,
|
code: ffi::SQLITE_MISUSE,
|
||||||
message: "Could not convert path to UTF-8 string".to_string()
|
message: format!("Could not convert path {} to UTF-8 string", p.to_string_lossy()),
|
||||||
}));
|
}));
|
||||||
str_to_cstring(s)
|
str_to_cstring(s)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user