Improve error handling for platform detection in Python downloads (#18453)
I noticed this weird error chain in https://github.com/astral-sh/uv/issues/8635#issuecomment-4055185865 ``` error: Failed to parse request part Caused by: Could not read ELF interpreter from any of the following paths: /bin/sh, /usr/bin/env, /bin/dash, /bin/ls ``` Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -405,7 +405,10 @@ impl PythonDownloadRequest {
|
||||
///
|
||||
/// Platform information is pulled from the environment.
|
||||
pub fn fill_platform(mut self) -> Result<Self, Error> {
|
||||
let platform = Platform::from_env()?;
|
||||
let platform = Platform::from_env().map_err(|err| match err {
|
||||
platform::Error::LibcDetectionError(err) => Error::LibcDetection(err),
|
||||
err => Error::InvalidRequestPlatform(err),
|
||||
})?;
|
||||
if self.arch.is_none() {
|
||||
self.arch = Some(ArchRequest::Environment(platform.arch));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user