Log the debug error trace (#14458)

For #14425. We can see the error without `error(transparent)` applied by
looking at the debug representation.
This commit is contained in:
konsti 2025-07-31 19:13:09 +02:00 committed by GitHub
parent 1bca8bd044
commit 56677c540a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 9 additions and 4 deletions

View File

@ -6,7 +6,7 @@ use std::time::Instant;
use anstream::eprintln; use anstream::eprintln;
use owo_colors::OwoColorize; use owo_colors::OwoColorize;
use tracing::debug; use tracing::{debug, trace};
use tracing_durations_export::DurationsLayerBuilder; use tracing_durations_export::DurationsLayerBuilder;
use tracing_durations_export::plot::PlotConfig; use tracing_durations_export::plot::PlotConfig;
use tracing_subscriber::filter::Directive; use tracing_subscriber::filter::Directive;
@ -68,6 +68,7 @@ async fn main() -> ExitCode {
let result = run().await; let result = run().await;
debug!("Took {}ms", start.elapsed().as_millis()); debug!("Took {}ms", start.elapsed().as_millis());
if let Err(err) = result { if let Err(err) = result {
trace!("Error trace: {err:?}");
eprintln!("{}", "uv-dev failed".red().bold()); eprintln!("{}", "uv-dev failed".red().bold());
for err in err.chain() { for err in err.chain() {
eprintln!(" {}: {}", "Caused by".red().bold(), err.to_string().trim()); eprintln!(" {}: {}", "Caused by".red().bold(), err.to_string().trim());

View File

@ -6,7 +6,7 @@ use anyhow::{Context, Result, bail};
use console::Term; use console::Term;
use owo_colors::{AnsiColors, OwoColorize}; use owo_colors::{AnsiColors, OwoColorize};
use tokio::sync::Semaphore; use tokio::sync::Semaphore;
use tracing::{debug, info}; use tracing::{debug, info, trace};
use uv_auth::Credentials; use uv_auth::Credentials;
use uv_cache::Cache; use uv_cache::Cache;
use uv_client::{AuthIntegration, BaseClient, BaseClientBuilder, RegistryClientBuilder}; use uv_client::{AuthIntegration, BaseClient, BaseClientBuilder, RegistryClientBuilder};
@ -274,6 +274,7 @@ async fn gather_credentials(
publishing, you can ignore this error, but you need to provide credentials." publishing, you can ignore this error, but you need to provide credentials."
)?; )?;
trace!("Error trace: {err:?}");
write_error_chain( write_error_chain(
anyhow::Error::from(err) anyhow::Error::from(err)
.context("Trusted publishing failed") .context("Trusted publishing failed")

View File

@ -706,6 +706,7 @@ pub(crate) async fn install(
Some(true) => ("error", AnsiColors::Red), Some(true) => ("error", AnsiColors::Red),
}; };
trace!("Error trace: {err:?}");
write_error_chain( write_error_chain(
err.context(format!("Failed to create registry entry for {key}")) err.context(format!("Failed to create registry entry for {key}"))
.as_ref(), .as_ref(),

View File

@ -4,7 +4,7 @@ use owo_colors::{AnsiColors, OwoColorize};
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::fmt::Write; use std::fmt::Write;
use std::str::FromStr; use std::str::FromStr;
use tracing::debug; use tracing::{debug, trace};
use uv_cache::Cache; use uv_cache::Cache;
use uv_client::BaseClientBuilder; use uv_client::BaseClientBuilder;
@ -157,6 +157,7 @@ pub(crate) async fn upgrade(
.into_iter() .into_iter()
.sorted_unstable_by(|(name_a, _), (name_b, _)| name_a.cmp(name_b)) .sorted_unstable_by(|(name_a, _), (name_b, _)| name_a.cmp(name_b))
{ {
trace!("Error trace: {err:?}");
write_error_chain( write_error_chain(
err.context(format!("Failed to upgrade {}", name.green())) err.context(format!("Failed to upgrade {}", name.green()))
.as_ref(), .as_ref(),

View File

@ -17,7 +17,7 @@ use futures::FutureExt;
use owo_colors::OwoColorize; use owo_colors::OwoColorize;
use settings::PipTreeSettings; use settings::PipTreeSettings;
use tokio::task::spawn_blocking; use tokio::task::spawn_blocking;
use tracing::{debug, instrument}; use tracing::{debug, instrument, trace};
use uv_cache::{Cache, Refresh}; use uv_cache::{Cache, Refresh};
use uv_cache_info::Timestamp; use uv_cache_info::Timestamp;
@ -2330,6 +2330,7 @@ where
match result { match result {
Ok(code) => code.into(), Ok(code) => code.into(),
Err(err) => { Err(err) => {
trace!("Error trace: {err:?}");
let mut causes = err.chain(); let mut causes = err.chain();
eprintln!( eprintln!(
"{}: {}", "{}: {}",