Skip to content

Commit 5ee728b

Browse files
authored
Retry all h2 errors (#16038)
The h2 errors, a specific type nested in reqwest errors, all look like they shouldn't happen in regular operations and should be retried. This covers all `io::Error`s going through h2 (i.e., only HTTP 2 connections). Fixes #15916
1 parent d3dc451 commit 5ee728b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

crates/uv-client/src/base_client.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,12 +1029,12 @@ pub fn is_transient_network_error(err: &(dyn Error + 'static)) -> bool {
10291029
}
10301030

10311031
trace!("Cannot retry nested reqwest error");
1032-
} else if let Some(io_err) = source.downcast_ref::<io::Error>().or_else(|| {
1033-
// h2 may hide an IO error inside.
1034-
source
1035-
.downcast_ref::<h2::Error>()
1036-
.and_then(|err| err.get_io())
1037-
}) {
1032+
} else if source.downcast_ref::<h2::Error>().is_some() {
1033+
// All h2 errors look like errors that should be retried
1034+
// https://github.com/astral-sh/uv/issues/15916
1035+
trace!("Retrying nested h2 error");
1036+
return true;
1037+
} else if let Some(io_err) = source.downcast_ref::<io::Error>() {
10381038
has_known_error = true;
10391039
let retryable_io_err_kinds = [
10401040
// https://github.com/astral-sh/uv/issues/12054

0 commit comments

Comments
 (0)