Refactor for rich errors, split user abort and genuine error

This commit is contained in:
Félix Saparelli 2022-05-31 20:51:32 +12:00
parent 3c38a2f0eb
commit c0eaffb05d
No known key found for this signature in database
GPG key ID: B948C4BAE44FC474
11 changed files with 340 additions and 138 deletions

View file

@ -4,7 +4,7 @@ pub use gh_crate_meta::*;
pub use log::debug;
pub use quickinstall::*;
use crate::{PkgFmt, PkgMeta};
use crate::{BinstallError, PkgFmt, PkgMeta};
mod gh_crate_meta;
mod quickinstall;
@ -17,10 +17,10 @@ pub trait Fetcher {
Self: Sized;
/// Fetch a package
async fn fetch(&self, dst: &Path) -> Result<(), anyhow::Error>;
async fn fetch(&self, dst: &Path) -> Result<(), BinstallError>;
/// Check if a package is available for download
async fn check(&self) -> Result<bool, anyhow::Error>;
async fn check(&self) -> Result<bool, BinstallError>;
/// Return the package format
fn pkg_fmt(&self) -> PkgFmt;