Handle JoinHandle panic in view
This commit is contained in:
parent
11402254e1
commit
aed8a28aac
|
@ -202,7 +202,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hanimers"
|
name = "hanimers"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"quick-xml",
|
"quick-xml",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "hanimers"
|
name = "hanimers"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
authors = ["blank X <theblankx@protonmail.com>"]
|
authors = ["blank X <theblankx@protonmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|
|
@ -20,14 +20,27 @@ pub async fn view(arg_m: &ArgMatches<'_>) {
|
||||||
let handles = arg_m.values_of("id").unwrap().map(|id| {
|
let handles = arg_m.values_of("id").unwrap().map(|id| {
|
||||||
let cloned_client = client.clone();
|
let cloned_client = client.clone();
|
||||||
let id = id.to_string();
|
let id = id.to_string();
|
||||||
tokio::spawn(async move {
|
let cid = id.clone();
|
||||||
(utils::get_hentai(cloned_client, &id).await, id)
|
(tokio::spawn(async move {
|
||||||
})
|
utils::get_hentai(cloned_client, &cid).await
|
||||||
|
}), id)
|
||||||
}).collect::<Vec<_>>();
|
}).collect::<Vec<_>>();
|
||||||
let mut fail = false;
|
let mut fail = false;
|
||||||
let mut one_done = false;
|
let mut one_done = false;
|
||||||
for handle in handles {
|
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 {
|
match hentai {
|
||||||
Ok(hentai) => {
|
Ok(hentai) => {
|
||||||
match hentai {
|
match hentai {
|
||||||
|
|
|
@ -8,7 +8,7 @@ fn main() {
|
||||||
let matches = App::new("hanimers")
|
let matches = App::new("hanimers")
|
||||||
.about("hanime.tv downloader in rust")
|
.about("hanime.tv downloader in rust")
|
||||||
// let's hope i remember to bump the version xd
|
// let's hope i remember to bump the version xd
|
||||||
.version("0.1.2")
|
.version("0.1.3")
|
||||||
.setting(AppSettings::SubcommandRequiredElseHelp)
|
.setting(AppSettings::SubcommandRequiredElseHelp)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("search")
|
SubCommand::with_name("search")
|
||||||
|
|
Loading…
Reference in New Issue