diff --git a/crates/cli/src/node_manager/node_manager.rs b/crates/cli/src/node_manager/node_manager.rs index 64ba137d..5c7dcc5a 100644 --- a/crates/cli/src/node_manager/node_manager.rs +++ b/crates/cli/src/node_manager/node_manager.rs @@ -249,7 +249,9 @@ where } } snm_config::InstallStrategy::Panic => { - return Err(SnmError::UnsupportedInstallNodeVersionError) + return Err(SnmError::UnsupportedNodeVersionError { + version: version.to_string(), + }) } snm_config::InstallStrategy::Auto => { self.internal_download(version).await?; diff --git a/crates/snm_shim/src/ensure_binary_path.rs b/crates/snm_shim/src/ensure_binary_path.rs index 828feafd..4a4181fb 100644 --- a/crates/snm_shim/src/ensure_binary_path.rs +++ b/crates/snm_shim/src/ensure_binary_path.rs @@ -13,12 +13,13 @@ where .exists() .not() { - // if manage.download_condition(version.as_str()) { - // download(version.as_str(), manage).await?; - // } else { - // // exit 0 - // } - download(version.as_str(), manage).await?; + if manage.get_snm_config().get_strict() { + return Err(SnmError::UnsupportedNodeVersionError { + version: version.to_string(), + }); + } else { + download(version.as_str(), manage).await?; + } } let binary = manage.get_runtime_binary_dir_string(version.as_str())?; diff --git a/crates/snm_utils/src/snm_error.rs b/crates/snm_utils/src/snm_error.rs index 61f91591..147c07bc 100644 --- a/crates/snm_utils/src/snm_error.rs +++ b/crates/snm_utils/src/snm_error.rs @@ -78,8 +78,8 @@ pub enum SnmError { actual: String, }, - #[error("Unsupported install node version error")] - UnsupportedInstallNodeVersionError, + #[error("Unsupported node v{version} ")] + UnsupportedNodeVersionError { version: String }, } pub fn friendly_error_message(error: SnmError) { @@ -307,13 +307,13 @@ pub fn friendly_error_message(error: SnmError) { | SnmError::NetworkError(_) | SnmError::DialoguerError(_) | SnmError::VarError(_) - | SnmError::UnsupportedInstallNodeVersionError + | SnmError::UnsupportedNodeVersionError { version: _ } | SnmError::CannotFindDefaultCommand { command: _ } | SnmError::ZipError(_) | SnmError::IOError(_) => { let msg = format!("{}", error.to_string()); - panic!("{msg}"); - // eprintln!("[error]: {}", msg); + // panic!("{msg}"); + eprintln!("[error]: {}", msg); } }