mirror of
https://github.com/huhu/rust-search-extension
synced 2024-11-14 15:47:12 +00:00
Ignore deserialize failed csv record
Such as error: `invalid leading zero in pre-release identifier` caused by 1.2.3-alpha.012.2
This commit is contained in:
parent
b03c609cc7
commit
1b54b7ae5e
1 changed files with 10 additions and 1 deletions
|
@ -90,7 +90,16 @@ fn default_version() -> Version {
|
|||
|
||||
fn read_csv<D: DeserializeOwned>(file: impl Read) -> crate::Result<Vec<D>> {
|
||||
let mut reader = ReaderBuilder::new().has_headers(true).from_reader(file);
|
||||
Ok(reader.deserialize().map(|record| record.unwrap()).collect())
|
||||
Ok(reader
|
||||
.deserialize()
|
||||
.filter_map(|record| match record {
|
||||
Ok(record) => Some(record),
|
||||
Err(err) => {
|
||||
println!("Deserialize csv record failed: {:?}", err);
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
fn generate_javascript_crates_index(crates: Vec<Crate>, minifier: &Minifier) -> String {
|
||||
|
|
Loading…
Reference in a new issue