aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index 21b4d82..28de762 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -25,7 +25,7 @@ struct Args {
}
#[tokio::main]
-async fn main() -> Result<(), Error> {
+async fn main() -> Result<(), Vec<Error>> {
let (args, urls) = {
let mut args: Args = Args::from_args();
let mut urls = mem::take(&mut args.urls);
@@ -48,7 +48,13 @@ async fn main() -> Result<(), Error> {
.into_iter()
.map(|url| download(url, &args));
let downloads = futures::future::join_all(download_handles);
- let _downloads = downloads.await;
-
- Ok(())
+ let download_errors = downloads.await
+ .into_iter()
+ .filter_map(|x| x.err())
+ .collect::<Vec<Error>>();
+ if download_errors.len() > 0 {
+ Err(download_errors)
+ } else {
+ Ok(())
+ }
}