mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-22 11:50:02 +00:00
Refactor: Extract new crate binstalk-fetchers
(#1291)
To reduce `binstalk` codegen and enable better reuse. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
623f7ff4ed
commit
76c72469eb
19 changed files with 1008 additions and 122 deletions
|
@ -7,6 +7,7 @@ use std::{
|
|||
use binstalk_downloader::{
|
||||
download::DownloadError, gh_api_client::GhApiError, remote::Error as RemoteError,
|
||||
};
|
||||
use binstalk_fetchers::FetchError;
|
||||
use compact_str::CompactString;
|
||||
use miette::{Diagnostic, Report};
|
||||
use target_lexicon::ParseError as TargetTripleParseError;
|
||||
|
@ -94,6 +95,16 @@ pub enum BinstallError {
|
|||
leon::ParseError,
|
||||
),
|
||||
|
||||
/// Failed to fetch pre-built binaries.
|
||||
///
|
||||
/// - Code: `binstall::fetch`
|
||||
/// - Exit: 68
|
||||
#[error(transparent)]
|
||||
#[diagnostic(severity(error), code(binstall::fetch))]
|
||||
#[source_code(transparent)]
|
||||
#[label(transparent)]
|
||||
FetchError(Box<FetchError>),
|
||||
|
||||
/// Failed to render template.
|
||||
///
|
||||
/// - Code: `binstall::template`
|
||||
|
@ -352,6 +363,7 @@ impl BinstallError {
|
|||
UserAbort => 32,
|
||||
UrlParse(_) => 65,
|
||||
TemplateParseError(..) => 67,
|
||||
FetchError(..) => 68,
|
||||
TemplateRenderError(..) => 69,
|
||||
Download(_) => 68,
|
||||
SubProcess { .. } => 70,
|
||||
|
@ -494,3 +506,9 @@ impl From<LoadManifestFromWSError> for BinstallError {
|
|||
BinstallError::LoadManifestFromWSError(Box::new(e))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<FetchError> for BinstallError {
|
||||
fn from(e: FetchError) -> Self {
|
||||
BinstallError::FetchError(Box::new(e))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue