Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more context on resolve client error #8285

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions crates/uv-client/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ impl Error {
match &*self.kind {
// The server doesn't support range requests (as reported by the `HEAD` check).
ErrorKind::AsyncHttpRangeReader(
_,
AsyncHttpRangeReaderError::HttpRangeRequestUnsupported,
) => {
return true;
}

// The server doesn't support range requests (it doesn't return the necessary headers).
ErrorKind::AsyncHttpRangeReader(
_,
AsyncHttpRangeReaderError::ContentLengthMissing
| AsyncHttpRangeReaderError::ContentRangeMissing,
) => {
Expand Down Expand Up @@ -187,8 +189,8 @@ pub enum ErrorKind {
#[error("Received some unexpected HTML from {url}")]
BadHtml { source: html::Error, url: Url },

#[error(transparent)]
AsyncHttpRangeReader(#[from] AsyncHttpRangeReaderError),
#[error("Failed to read zip with range requests: `{0}`")]
AsyncHttpRangeReader(Url, #[source] AsyncHttpRangeReaderError),

#[error("{0} is not a valid wheel filename")]
WheelFilename(#[source] WheelFilenameError),
Expand Down
2 changes: 1 addition & 1 deletion crates/uv-client/src/registry_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ impl RegistryClient {
headers,
)
.await
.map_err(ErrorKind::AsyncHttpRangeReader)?;
.map_err(|err| ErrorKind::AsyncHttpRangeReader(url.clone(), err))?;
trace!("Getting metadata for {filename} by range request");
let text = wheel_metadata_from_remote_zip(filename, url, &mut reader).await?;
let metadata =
Expand Down
Loading