diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-25 15:46:51 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-25 15:46:51 +0200 |
commit | e8d165fe0ef18530f3c921778cae1d4b2bed2ee1 (patch) | |
tree | 2ba9c36ea1e3270b1820472e85b22f816f336b0e | |
parent | fix(yt_dlp/info_json): Accept further missing fields in the info_json (diff) | |
download | yt-e8d165fe0ef18530f3c921778cae1d4b2bed2ee1.tar.gz yt-e8d165fe0ef18530f3c921778cae1d4b2bed2ee1.zip |
docs(cache): Add context to the cache_path deletion error
-rw-r--r-- | src/cache/mod.rs | 10 |
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() + ) + })?; } } |