Skip to content

Commit b194120

Browse files
Improve logging when a permission error happens during clean up
1 parent b17a135 commit b194120

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/cleanup.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ pub async fn clean_up_old_previews(target_dir: &Path,
2929
&preview_path,
3030
last_modified,
3131
retention_days);
32-
fs::remove_dir_all(&preview_path)?;
32+
if let Err(e) = fs::remove_dir_all(&preview_path) {
33+
// PermissionError does not report the failing path
34+
// Showing it here in the logs
35+
log::error!("Unable to delete {:?}", &preview_path);
36+
return Err(errors::PreviewerError::IOError(e));
37+
38+
}
3339
deletion_counter += 1;
3440
}
3541
}

0 commit comments

Comments
 (0)