mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-17 13:58:29 +00:00
Improve trace log for retryable errors (#13228)
Previously, this looked like > TRACE Considering retry of error: Error { kind: WrappedReqwestError(Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("pkgs.dev.azure.com")), port: None, path: "/My-Project-Name/_packaging/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX/pypi/download/rr-config/4/rr_config-4.0.0-py3-none-any.whl", query: None, fragment: None }, WrappedReqwestError(Reqwest(reqwest::Error { kind: Status(405), url: "https://pkgs.dev.azure.com/My-Project-Name/_packaging/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX/pypi/download/rr-config/4/rr_config-4.0.0-py3-none-any.whl" }))) }
This commit is contained in:
parent
d8e472cfa8
commit
671d609127
1 changed files with 12 additions and 1 deletions
|
@ -480,7 +480,18 @@ impl RetryableStrategy for UvRetryableStrategy {
|
|||
///
|
||||
/// These cases should be safe to retry with [`Retryable::Transient`].
|
||||
pub fn is_extended_transient_error(err: &dyn Error) -> bool {
|
||||
trace!("Considering retry of error: {err:?}");
|
||||
// First, try to show a nice trace log
|
||||
if let Some((Some(status), Some(url))) = find_source::<reqwest::Error>(&err)
|
||||
.map(|request_err| (request_err.status(), request_err.url()))
|
||||
{
|
||||
let status = status
|
||||
.canonical_reason()
|
||||
.map(|reason| format!(" HTTP {status} {reason} "))
|
||||
.unwrap_or_else(|| format!(" HTTP {status} "));
|
||||
trace!("Considering retry of {status} for {url}");
|
||||
} else {
|
||||
trace!("Considering retry of error: {err:?}");
|
||||
}
|
||||
|
||||
if let Some(io) = find_source::<std::io::Error>(&err) {
|
||||
if io.kind() == std::io::ErrorKind::ConnectionReset
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue