From 0eb9132591a454797229b8f12d3e1eae9258c746 Mon Sep 17 00:00:00 2001 From: ityuany <519495771@qq.com> Date: Sat, 20 Jul 2024 02:20:10 +0800 Subject: [PATCH] add snm_error UnsupportedInstallNodeVersionError --- crates/cli/src/node_manager/node_manager.rs | 4 +++- crates/snm_utils/src/snm_error.rs | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/cli/src/node_manager/node_manager.rs b/crates/cli/src/node_manager/node_manager.rs index 13c37b4c..64ba137d 100644 --- a/crates/cli/src/node_manager/node_manager.rs +++ b/crates/cli/src/node_manager/node_manager.rs @@ -248,7 +248,9 @@ where self.internal_download(version).await?; } } - snm_config::InstallStrategy::Panic => todo!(), + snm_config::InstallStrategy::Panic => { + return Err(SnmError::UnsupportedInstallNodeVersionError) + } snm_config::InstallStrategy::Auto => { self.internal_download(version).await?; } diff --git a/crates/snm_utils/src/snm_error.rs b/crates/snm_utils/src/snm_error.rs index 8a3af65f..61f91591 100644 --- a/crates/snm_utils/src/snm_error.rs +++ b/crates/snm_utils/src/snm_error.rs @@ -77,6 +77,9 @@ pub enum SnmError { expect: String, actual: String, }, + + #[error("Unsupported install node version error")] + UnsupportedInstallNodeVersionError, } pub fn friendly_error_message(error: SnmError) { @@ -304,6 +307,7 @@ pub fn friendly_error_message(error: SnmError) { | SnmError::NetworkError(_) | SnmError::DialoguerError(_) | SnmError::VarError(_) + | SnmError::UnsupportedInstallNodeVersionError | SnmError::CannotFindDefaultCommand { command: _ } | SnmError::ZipError(_) | SnmError::IOError(_) => {