Provide better errors when packages aren't found.
This commit is contained in:
parent
6e64bb72e6
commit
b475d6a6a4
|
@ -78,13 +78,19 @@ impl<'a> Downloader<'a> {
|
|||
.get(url)
|
||||
.header("User-Agent", "aiken-lang")
|
||||
.send()
|
||||
.await?
|
||||
.bytes()
|
||||
.await?;
|
||||
|
||||
if response.status().as_u16() >= 400 {
|
||||
return Err(Error::UnknownPackageVersion {
|
||||
package: package.clone(),
|
||||
});
|
||||
}
|
||||
|
||||
let bytes = response.bytes().await?;
|
||||
|
||||
// let PackageSource::Github { url } = &package.source;
|
||||
|
||||
tokio::fs::write(&zipball_path, response).await?;
|
||||
tokio::fs::write(&zipball_path, bytes).await?;
|
||||
|
||||
Ok(true)
|
||||
}
|
||||
|
|
|
@ -323,7 +323,7 @@ impl Diagnostic for Error {
|
|||
Error::Http(_) => None,
|
||||
Error::ZipExtract(_) => None,
|
||||
Error::JoinError(_) => None,
|
||||
Error::UnknownPackageVersion{..} => None,
|
||||
Error::UnknownPackageVersion{..} => Some(Box::new("Perhaps, double-check the package repository and version?")),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ pub fn default_aiken_cache() -> PathBuf {
|
|||
.join("aiken")
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CacheKey {
|
||||
key: String,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue