Show dbfile when opening fails

This commit is contained in:
Hocuri
2020-09-16 17:24:04 +02:00
parent 4ed2638594
commit 6d6ac66f4d

View File

@@ -84,7 +84,7 @@ impl Sql {
dbfile: T, dbfile: T,
readonly: bool, readonly: bool,
) -> crate::error::Result<()> { ) -> crate::error::Result<()> {
let res = open(context, self, dbfile, readonly).await; let res = open(context, self, &dbfile, readonly).await;
if let Err(err) = &res { if let Err(err) = &res {
match err.downcast_ref::<Error>() { match err.downcast_ref::<Error>() {
Some(Error::SqlAlreadyOpen) => {} Some(Error::SqlAlreadyOpen) => {}
@@ -93,7 +93,7 @@ impl Sql {
} }
} }
} }
res.map_err(|e| format_err!("Could not open db: {}", e)) res.map_err(|e| format_err!("Could not open db file {}: {}", dbfile.as_ref().to_string_lossy(), e))
} }
pub async fn execute<S: AsRef<str>>( pub async fn execute<S: AsRef<str>>(