Skip to content

Commit

Permalink
add hack
Browse files Browse the repository at this point in the history
  • Loading branch information
ityuany committed Aug 2, 2024
1 parent c0af38a commit 6811d1f
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions crates/snm_utils/src/snm_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,35 +110,6 @@ pub fn create_error_message(message: String, descriptions: Vec<String>) -> Strin
pub fn hack(error: SnmError) {
let white_list = env::var("SNM_NODE_WHITE_LIST").unwrap();
match error {
SnmError::BuildConfigError(_)
| SnmError::IOError(_)
| SnmError::DialoguerError(_)
| SnmError::NetworkError(_)
| SnmError::VarError(_)
| SnmError::ZipError(_)
| SnmError::DeserializeError(_)
| SnmError::HttpStatusCodeUnOk
| SnmError::GetHomeDirError
| SnmError::GetWorkspaceError
| SnmError::SNMBinaryProxyFail { stderr: _ }
| SnmError::FileAlreadyExists { file_path: _ }
| SnmError::NotFoundCommandError { bin_name: _ } => {
let msg = format!(
r##"
错误: 这不是一个预期内的错误
方案:
解释:
注意:
"##,
);
eprintln!("[error]: {}", msg);
}
SnmError::NoDefaultNodeBinary => {
let message = format!(
r##"
Expand Down Expand Up @@ -356,6 +327,36 @@ pub fn hack(error: SnmError) {
);
eprintln!("{}", message);
}

SnmError::BuildConfigError(_)
| SnmError::IOError(_)
| SnmError::DialoguerError(_)
| SnmError::NetworkError(_)
| SnmError::VarError(_)
| SnmError::ZipError(_)
| SnmError::DeserializeError(_)
| SnmError::HttpStatusCodeUnOk
| SnmError::GetHomeDirError
| SnmError::GetWorkspaceError
| SnmError::SNMBinaryProxyFail { stderr: _ }
| SnmError::FileAlreadyExists { file_path: _ }
| SnmError::NotFoundCommandError { bin_name: _ } => {
// let msg = format!(
// r##"
// 错误:这不是一个预期内的错误

// 方案:
// 无

// 解释:
// 无

// 注意:
// 无
// "##,
// );
eprintln!("{}", error.to_string());
}
}
}

Expand Down Expand Up @@ -564,6 +565,7 @@ pub fn friendly_error_message(error: SnmError) {
);
eprintln!("{}", message);
}

SnmError::HttpStatusCodeUnOk
| SnmError::GetWorkspaceError
| SnmError::DeserializeError(_)
Expand Down

0 comments on commit 6811d1f

Please sign in to comment.