Skip to content

Commit

Permalink
Show all errors instead of the first one found
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelotrevisani committed Jan 4, 2024
1 parent deba8b4 commit f5f6caf
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/cli/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::path::PathBuf;
use std::str::FromStr;

use clap::Parser;
use miette::miette;
use rattler_conda_types::{NamelessMatchSpec, PackageName, Platform};

use crate::environment::LockFileUsage;
Expand Down Expand Up @@ -100,6 +99,7 @@ pub async fn execute(args: Args) -> miette::Result<()> {
console::style(table_name).bold()
)
}
let mut all_errors = Vec::new();
for result in results.iter() {
match result {
DependencyRemovalResult::Conda(Ok(pixi_result)) => print_ok_dep_removal(
Expand All @@ -115,9 +115,14 @@ pub async fn execute(args: Args) -> miette::Result<()> {
DependencyRemovalResult::Conda(Err(e))
| DependencyRemovalResult::PyPi(Err(e))
| DependencyRemovalResult::Error(e) => {
return Err(miette!("{e}"));
all_errors.push(format!("{e}"));
}
}
}
Ok(())

if all_errors.is_empty() {
Ok(())
} else {
Err(miette::miette!(all_errors.join("\n")))
}
}

0 comments on commit f5f6caf

Please sign in to comment.