Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
ityuany committed Jul 20, 2024
1 parent 42f3a0b commit 25d97da
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
4 changes: 3 additions & 1 deletion crates/cli/src/node_manager/node_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
Expand Down
13 changes: 7 additions & 6 deletions crates/snm_shim/src/ensure_binary_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())?;
Expand Down
10 changes: 5 additions & 5 deletions crates/snm_utils/src/snm_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 25d97da

Please sign in to comment.