chore: 官网拆分 homepage + 关于页瘦身 + 端口 5175(当前可用状态基线)
This commit is contained in:
1 parent
5eb11826db
commit
be151cb68f
85 files changed
+4420
-1530
No files matched your search
@@ -9,3 +9,33 @@ pub mod codes {
|
||||
pub const KNOWN_HOSTS_PATH: &str = "native.knownHostsPath";
|
||||
pub const INVALID_HOST_KEY_DECISION: &str = "native.invalidHostKeyDecision";
|
||||
}
|
||||
|
||||
/// Domain failures retain their cause while exposing stable IPC codes where available.
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum AppError {
|
||||
#[error(transparent)]
|
||||
Io(#[from] std::io::Error),
|
||||
#[error(transparent)]
|
||||
InvalidBase64(#[from] base64::DecodeError),
|
||||
#[error("{0}")]
|
||||
TaskJoin(String),
|
||||
}
|
||||
|
||||
impl AppError {
|
||||
pub fn code(&self) -> Option<&'static str> {
|
||||
match self {
|
||||
Self::Io(_) => None,
|
||||
Self::InvalidBase64(_) => Some(codes::INVALID_BASE64),
|
||||
Self::TaskJoin(_) => Some(codes::TASK_JOIN),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<AppError> for crate::domain::ssh::OperationResponse {
|
||||
fn from(error: AppError) -> Self {
|
||||
match error.code() {
|
||||
Some(code) => Self::coded(code, error.to_string()),
|
||||
None => Self::error(error.to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user