Print a nicer error when failing to create cache directory (#2728)

Same as in 1d2248571d for the config
directory, when the cache directory fails to get created for whichever
reason, we currently exit gitui with a pretty undescriptive error.

Improves on #2684.
Fixes #2652.
This commit is contained in:
linkmauve 2025-10-09 11:01:37 +02:00 committed by GitHub
parent 1d2248571d
commit 180368621e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixes
* resolve `core.hooksPath` relative to `GIT_WORK_TREE` [[@naseschwarz](https://github.com/naseschwarz)] ([#2571](https://github.com/gitui-org/gitui/issues/2571))
* yanking commit ranges no longer generates incorrect dotted range notations, but lists each individual commit [[@naseschwarz](https://github.com/naseschwarz)] (https://github.com/gitui-org/gitui/issues/2576)
* print slightly nicer errors when failing to create a directory [[@linkmauve](https://github.com/linkmauve)] (https://github.com/gitui-org/gitui/pull/2728)
## [0.27.0] - 2024-01-14

View file

@ -159,7 +159,12 @@ fn get_app_cache_path() -> Result<PathBuf> {
.ok_or_else(|| anyhow!("failed to find os cache dir."))?;
path.push("gitui");
fs::create_dir_all(&path)?;
fs::create_dir_all(&path).with_context(|| {
format!(
"failed to create cache directory: {}",
path.display()
)
})?;
Ok(path)
}