diff --git a/src/comments_docsource.rs b/src/comments_docsource.rs index 3d31347..9146c26 100644 --- a/src/comments_docsource.rs +++ b/src/comments_docsource.rs @@ -174,12 +174,19 @@ impl DocSource for CommentsDatabase { fn update(&mut self) -> Result { let files = find_nix_files(get_nixpkgs_root()) .par_iter() - .map(|f| { - let content = std::fs::read_to_string(f.path()).unwrap(); - let mut hasher = crc32fast::Hasher::new(); - hasher.update(content.as_bytes()); - let hash = hasher.finalize(); - (hash, f.path().to_path_buf(), content) + .filter_map(|f| { + match std::fs::read_to_string(f.path()) { + Ok(content) => { + let mut hasher = crc32fast::Hasher::new(); + hasher.update(content.as_bytes()); + let hash = hasher.finalize(); + Some ((hash, f.path().to_path_buf(), content)) + }, + Err(_) => { + eprintln!("Skipped {}", f.path().to_str()?); + None + }, + } }) .collect::>();