Skip to content

Commit

Permalink
Fix the error propagation of the "source download" command
Browse files Browse the repository at this point in the history
The additional source verification in 2f8034b introduced a regression by
returning the source verification errors before the errors of the
download operation (the download errors therefore get omitted and users
get misleading errors that the sources are missing and that the
verification did therefore fail).

This restores the proper error messages and avoids unnecessary source
verification by returning errors of the download operation before
triggering the verification.

We also don't need the debug output as we already return the errors and
I've put `Ok(())` at the end to make it a bit more readable.

Signed-off-by: Michael Weiss <michael.weiss@eviden.com>
  • Loading branch information
primeos-work committed Jul 12, 2024
1 parent cbfc0b6 commit 2c0d17e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/commands/source/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use clap::ArgMatches;
use tokio::io::AsyncWriteExt;
use tokio::sync::Mutex;
use tokio_stream::StreamExt;
use tracing::{debug, info, trace, warn};
use tracing::{info, trace, warn};

use crate::config::*;
use crate::package::PackageName;
Expand Down Expand Up @@ -305,13 +305,12 @@ pub async fn download(

if r.is_err() {
progressbar.lock().await.error().await;
return r;
} else {
progressbar.lock().await.success().await;
}

debug!("r = {:?}", r);

super::verify(matches, config, repo, progressbars).await?;

r
Ok(())
}

0 comments on commit 2c0d17e

Please sign in to comment.