Add new variant BinstallError::TaskJoinError

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-07-21 20:40:31 +10:00
parent ef72f851f7
commit 46cf20a3f7
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -3,6 +3,7 @@ use std::process::{ExitCode, Termination};
use log::{error, warn}; use log::{error, warn};
use miette::{Diagnostic, Report}; use miette::{Diagnostic, Report};
use thiserror::Error; use thiserror::Error;
use tokio::task;
/// Errors emitted by the library portion of cargo-binstall. /// Errors emitted by the library portion of cargo-binstall.
#[derive(Error, Diagnostic, Debug)] #[derive(Error, Diagnostic, Debug)]
@ -185,6 +186,10 @@ pub enum BinstallError {
help("Remove the `--manifest-path` or only specify one `$crate_name`") help("Remove the `--manifest-path` or only specify one `$crate_name`")
)] )]
ManifestPathConflictedWithBatchInstallation, ManifestPathConflictedWithBatchInstallation,
#[error("Failed to join tokio::task::JoinHandle")]
#[diagnostic(severity(error), code(binstall::join_error))]
TaskJoinError(#[from] task::JoinError),
} }
impl BinstallError { impl BinstallError {
@ -213,6 +218,7 @@ impl BinstallError {
VersionUnavailable { .. } => 83, VersionUnavailable { .. } => 83,
DuplicateVersionReq => 84, DuplicateVersionReq => 84,
ManifestPathConflictedWithBatchInstallation => 85, ManifestPathConflictedWithBatchInstallation => 85,
TaskJoinError(_) => 17,
}; };
// reserved codes // reserved codes