diff --git a/Cargo.lock b/Cargo.lock index fe7a16f..5f545be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -202,7 +202,7 @@ dependencies = [ [[package]] name = "hanimers" -version = "0.1.2" +version = "0.1.3" dependencies = [ "clap", "quick-xml", diff --git a/Cargo.toml b/Cargo.toml index a03060b..e26691b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hanimers" -version = "0.1.2" +version = "0.1.3" authors = ["blank X "] edition = "2018" diff --git a/src/commands/view.rs b/src/commands/view.rs index e722e37..f5def35 100644 --- a/src/commands/view.rs +++ b/src/commands/view.rs @@ -20,14 +20,27 @@ pub async fn view(arg_m: &ArgMatches<'_>) { let handles = arg_m.values_of("id").unwrap().map(|id| { let cloned_client = client.clone(); let id = id.to_string(); - tokio::spawn(async move { - (utils::get_hentai(cloned_client, &id).await, id) - }) + let cid = id.clone(); + (tokio::spawn(async move { + utils::get_hentai(cloned_client, &cid).await + }), id) }).collect::>(); let mut fail = false; let mut one_done = false; for handle in handles { - let (hentai, id) = handle.await.unwrap(); + let (handle, id) = handle; + let hentai = match handle.await { + Ok(hentai) => hentai, + Err(err) => { + if one_done { + eprintln!(""); + } + eprintln!("ID: {}\nError: {}", id, err); + fail = true; + one_done = true; + continue; + } + }; match hentai { Ok(hentai) => { match hentai { diff --git a/src/main.rs b/src/main.rs index 8960868..fe2fa4f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,7 +8,7 @@ fn main() { let matches = App::new("hanimers") .about("hanime.tv downloader in rust") // let's hope i remember to bump the version xd - .version("0.1.2") + .version("0.1.3") .setting(AppSettings::SubcommandRequiredElseHelp) .subcommand( SubCommand::with_name("search")