Skip to content

Commit

Permalink
Provide more context on mkdir failures (#28)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Necior authored Jul 21, 2024
1 parent f23eea1 commit bfcb0e6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/storage/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ impl SqliteStorage {
}

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

let o = SqliteStorage { db_file };
Expand Down

0 comments on commit bfcb0e6

Please sign in to comment.