diff --git a/Cargo.lock b/Cargo.lock index 7c72d0e..64d1fd8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -421,7 +421,7 @@ dependencies = [ [[package]] name = "nhentairs" -version = "0.2.2" +version = "0.3.0" dependencies = [ "reqwest", "serde", diff --git a/Cargo.toml b/Cargo.toml index 25cba81..340e7b8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nhentairs" -version = "0.2.2" +version = "0.3.0" authors = ["blank X "] edition = "2018" diff --git a/src/commands/view.rs b/src/commands/view.rs index d6e9262..46740d2 100644 --- a/src/commands/view.rs +++ b/src/commands/view.rs @@ -4,7 +4,6 @@ use crate::structs; use std::env; use std::process::exit; use tokio::task::JoinHandle; -//use std::collections::BTreeMap; extern crate tokio; extern crate reqwest; @@ -23,15 +22,22 @@ pub async fn run(args: env::Args) { (utils::get_sauce_info(cloned_client, sauce).await.unwrap(), sauce) })); } + let mut fail = false; for handle in handles { let (sauce_info, sauce) = handle.await.unwrap(); match sauce_info { structs::GalleryInfo::Info(sauce_info) => println!("{}", utils::human_sauce_info(&sauce_info)), - structs::GalleryInfo::Error(sauce_error) => eprintln!("Sauce: {}\nError: {}", sauce, sauce_error.error) + structs::GalleryInfo::Error(sauce_error) => { + eprintln!("Sauce: {}\nError: {}", sauce, sauce_error.error); + fail = true; + } }; if remaining_to_show > 1 { println!(""); remaining_to_show -= 1; } } + if fail { + exit(1); + } }