aboutsummaryrefslogtreecommitdiffstats
path: root/src/cache
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-25 15:46:51 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-25 15:46:51 +0200
commite8d165fe0ef18530f3c921778cae1d4b2bed2ee1 (patch)
tree2ba9c36ea1e3270b1820472e85b22f816f336b0e /src/cache
parentfix(yt_dlp/info_json): Accept further missing fields in the info_json (diff)
downloadyt-e8d165fe0ef18530f3c921778cae1d4b2bed2ee1.zip
docs(cache): Add context to the cache_path deletion error
Diffstat (limited to 'src/cache')
-rw-r--r--src/cache/mod.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/cache/mod.rs b/src/cache/mod.rs
index ef8491a..a3e08c9 100644
--- a/src/cache/mod.rs
+++ b/src/cache/mod.rs
@@ -8,7 +8,7 @@
// You should have received a copy of the License along with this program.
// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-use anyhow::Result;
+use anyhow::{Context, Result};
use log::info;
use tokio::fs;
@@ -26,7 +26,13 @@ async fn invalidate_video(app: &App, video: &Video, hard: bool) -> Result<()> {
if hard {
if let Some(path) = &video.cache_path {
info!("Removing cached video at: '{}'", path.display());
- fs::remove_file(path).await?;
+ fs::remove_file(path).await.with_context(|| {
+ format!(
+ "Failed to delete video ('{}') cache path: '{}'.",
+ video.title,
+ path.display()
+ )
+ })?;
}
}