1
Fork 0

Add warning and debug information when cargo metadata fails

The errors are silently dropped elsewhere, which make it really hard to debug issues due to dependency download failures.
This commit is contained in:
Arthur Baars 2025-03-05 10:40:11 +01:00 committed by GitHub
parent 5ad05fb9e9
commit 049f4dbd2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -288,7 +288,22 @@ impl CargoWorkspace {
locked: bool,
progress: &dyn Fn(String),
) -> anyhow::Result<(cargo_metadata::Metadata, Option<anyhow::Error>)> {
Self::fetch_metadata_(cargo_toml, current_dir, config, sysroot, locked, false, progress)
let res = Self::fetch_metadata_(
cargo_toml,
current_dir,
config,
sysroot,
locked,
false,
progress,
);
if let Ok((_, Some(ref e))) = res {
tracing::warn!(
"`cargo metadata` failed on `{cargo_toml}`, but retry with `--no-deps` succeeded"
);
tracing::debug!("{e:?}");
}
res
}
fn fetch_metadata_(