From e8d165fe0ef18530f3c921778cae1d4b2bed2ee1 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sun, 25 Aug 2024 15:46:51 +0200 Subject: docs(cache): Add context to the cache_path deletion error --- src/cache/mod.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/cache') 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 . -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() + ) + })?; } } -- cgit 1.4.1