Skip to content

Commit

Permalink
Print niv & flake "Importing" lines via logging and add error detail
Browse files Browse the repository at this point in the history
This adds more details on import errors whenever they occur.
Previously we'd only print the first part of the error chain and thus
the user wouldn't get the error details that might be required for
fixing the error.
  • Loading branch information
andir committed May 11, 2024
1 parent 28881d7 commit 9409e11
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -703,10 +703,13 @@ impl Opts {
import(name, None, &mut pins, &niv).await?;
} else {
for (name, pin) in niv.iter() {
println!("Importing {}", name);
log::info!("Importing {}", name);
if let Err(err) = import(name, Some(pin), &mut pins, &niv).await {
log::error!("Failed to import pin '{}'", name);
log::error!("{}", err);
err.chain()
.skip(1)
.for_each(|cause| log::error!("\t{}", cause));
}
}
}
Expand Down Expand Up @@ -798,10 +801,13 @@ impl Opts {
.await?;
} else {
for (name, input_name) in inputs.iter() {
println!("Importing {}", name);
if let Err(err) = import(input_name, &mut pins, &nodes).await {
log::info!("Importing {}", name);
if let Err(err) = import(input_name, &mut pins, nodes).await {
log::error!("Failed to import pin '{}'", name);
log::error!("{}", err);
err.chain()
.skip(1)
.for_each(|cause| log::error!("\t{}", cause));
}
}
}
Expand Down

0 comments on commit 9409e11

Please sign in to comment.