Improve error messages for 'file not found' case (#550)

Right now, if you specify a wheel that doesn't exist, you get: `no such
file or directory` with no additional context. Oops!
This commit is contained in:
Charlie Marsh 2023-12-04 17:01:51 -05:00 committed by GitHub
parent 4e05cd5dfd
commit 5fddcc362e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 100 additions and 20 deletions

View file

@ -5,7 +5,7 @@ use pubgrub::report::{DefaultStringReporter, Reporter};
use thiserror::Error;
use url::Url;
use distribution_types::{BuiltDist, SourceDist};
use distribution_types::{BuiltDist, PathBuiltDist, PathSourceDist, SourceDist};
use pep508_rs::Requirement;
use puffin_distribution::DistributionDatabaseError;
use puffin_normalize::PackageName;
@ -54,11 +54,17 @@ pub enum ResolveError {
#[error(transparent)]
DistributionType(#[from] distribution_types::Error),
#[error("Failed to download {0}")]
#[error("Failed to download: {0}")]
Fetch(Box<BuiltDist>, #[source] DistributionDatabaseError),
#[error("Failed to download and build {0}")]
#[error("Failed to download and build: {0}")]
FetchAndBuild(Box<SourceDist>, #[source] DistributionDatabaseError),
#[error("Failed to read: {0}")]
Read(Box<PathBuiltDist>, #[source] DistributionDatabaseError),
#[error("Failed to build: {0}")]
Build(Box<PathSourceDist>, #[source] DistributionDatabaseError),
}
impl<T> From<futures::channel::mpsc::TrySendError<T>> for ResolveError {