Skip to content

Commit bfcb0e6

Browse files
authored
Provide more context on mkdir failures (#28)
For example, instead of: ``` Error: Permission denied (os error 13) ``` one will get: ``` Error: Failed to create `/var/lib/taskchampion-sync-server`. Caused by: Permission denied (os error 13) ``` after this patch is applied.
1 parent f23eea1 commit bfcb0e6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/storage/sqlite.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ impl SqliteStorage {
4242
}
4343

4444
pub fn new<P: AsRef<Path>>(directory: P) -> anyhow::Result<SqliteStorage> {
45-
std::fs::create_dir_all(&directory)?;
45+
std::fs::create_dir_all(&directory)
46+
.with_context(|| format!("Failed to create `{}`.", directory.as_ref().display()))?;
4647
let db_file = directory.as_ref().join("taskchampion-sync-server.sqlite3");
4748

4849
let o = SqliteStorage { db_file };

0 commit comments

Comments
 (0)