From 46cf20a3f74923a79c4667f6f9becaec9305bc9f Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Thu, 21 Jul 2022 20:40:31 +1000 Subject: [PATCH] Add new variant `BinstallError::TaskJoinError` Signed-off-by: Jiahao XU --- src/errors.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/errors.rs b/src/errors.rs index 6be71942..f8451ee3 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -3,6 +3,7 @@ use std::process::{ExitCode, Termination}; use log::{error, warn}; use miette::{Diagnostic, Report}; use thiserror::Error; +use tokio::task; /// Errors emitted by the library portion of cargo-binstall. #[derive(Error, Diagnostic, Debug)] @@ -185,6 +186,10 @@ pub enum BinstallError { help("Remove the `--manifest-path` or only specify one `$crate_name`") )] ManifestPathConflictedWithBatchInstallation, + + #[error("Failed to join tokio::task::JoinHandle")] + #[diagnostic(severity(error), code(binstall::join_error))] + TaskJoinError(#[from] task::JoinError), } impl BinstallError { @@ -213,6 +218,7 @@ impl BinstallError { VersionUnavailable { .. } => 83, DuplicateVersionReq => 84, ManifestPathConflictedWithBatchInstallation => 85, + TaskJoinError(_) => 17, }; // reserved codes