Skip to content

Commit

Permalink
better error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
ityuany committed Jul 21, 2024
1 parent ce7fdd5 commit d70ed7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 5 additions & 2 deletions crates/snm_shim/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ pub async fn load_package_manage_shim(prefix: &str, bin_name: &str) -> Result<()
ensure_binary_path(&snm_package_manage, &version).await?,
]
} else if restricted_list.contains(&command.as_str()) {
return Err(SnmError::CannotFindDefaultCommand {
command: bin_name.to_string(),
return Err(SnmError::NotMatchPackageManagerError {
// command: bin_name.to_string(),
raw_command: args_all.join(" ").to_string(),
expected: package_manager.name,
actual: prefix.to_string(),
});
} else {
vec![node_dir.clone(), get_default_bin_dir(&node_dir, bin_name)?]
Expand Down
6 changes: 1 addition & 5 deletions crates/snm_utils/src/snm_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,7 @@ pub fn friendly_error_message(error: SnmError) {
actual,
} => {
eprintln!(
r##"
👹 You Input: {} , Package Manager not match
The expected packageManager is {} , but the actual packageManager is {}.
"##,
r##"You input: {} , packageManager not match. The expected packageManager is {} , but the actual packageManager is {}."##,
raw_command.bold().red(),
expected.green(),
actual.red()
Expand Down

0 comments on commit d70ed7c

Please sign in to comment.