properly log torrent errors

This commit is contained in:
Tomáš Mládek 2022-01-19 23:27:35 +01:00
parent 3867bcbdae
commit b3dc24c3b8
No known key found for this signature in database
GPG key ID: ED21612889E75EC5

View file

@ -37,11 +37,17 @@ fn main() {
);
debug!("Torrent files: {}", torrent_files.join(", "));
let torrents = torrent_files
let torrents: Vec<(&str, Torrent)> = torrent_files
.into_iter()
.map(|f| Torrent::read_from_file(f).map(|t| (f, t)))
.collect::<Result<Vec<_>, _>>()
.unwrap();
.map(|path| (path, Torrent::read_from_file(path)))
.filter_map(|(path, torrent)| match torrent {
Ok(torrent) => Some((path, torrent)),
Err(err) => {
error!("Error loading \"{path}\"! {err}");
None
}
})
.collect();
for dir_entry in WalkDir::new(search_path).into_iter() {
if let Ok(dir_entry) = dir_entry {