Skip to content

Commit

Permalink
Improve logging when a permission error happens during clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
datapythonista committed Jan 26, 2024
1 parent b17a135 commit b194120
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ pub async fn clean_up_old_previews(target_dir: &Path,
&preview_path,
last_modified,
retention_days);
fs::remove_dir_all(&preview_path)?;
if let Err(e) = fs::remove_dir_all(&preview_path) {
// PermissionError does not report the failing path
// Showing it here in the logs
log::error!("Unable to delete {:?}", &preview_path);
return Err(errors::PreviewerError::IOError(e));

}
deletion_counter += 1;
}
}
Expand Down

0 comments on commit b194120

Please sign in to comment.