From c5fb22694e95f12c24b8d8af76999be7aea3fcec Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 12 Jan 2026 04:28:28 +0800 Subject: Reorganize crate structure and move documentation files --- crates/utils/tcp_connection/src/error.rs | 122 ------------------------------- 1 file changed, 122 deletions(-) delete mode 100644 crates/utils/tcp_connection/src/error.rs (limited to 'crates/utils/tcp_connection/src/error.rs') diff --git a/crates/utils/tcp_connection/src/error.rs b/crates/utils/tcp_connection/src/error.rs deleted file mode 100644 index 32d06cc..0000000 --- a/crates/utils/tcp_connection/src/error.rs +++ /dev/null @@ -1,122 +0,0 @@ -use std::io; -use thiserror::Error; - -#[derive(Error, Debug, Clone)] -pub enum TcpTargetError { - #[error("Authentication failed: {0}")] - Authentication(String), - - #[error("Reference sheet not allowed: {0}")] - ReferenceSheetNotAllowed(String), - - #[error("Cryptographic error: {0}")] - Crypto(String), - - #[error("File operation error: {0}")] - File(String), - - #[error("I/O error: {0}")] - Io(String), - - #[error("Invalid configuration: {0}")] - Config(String), - - #[error("Locked: {0}")] - Locked(String), - - #[error("Network error: {0}")] - Network(String), - - #[error("No result: {0}")] - NoResult(String), - - #[error("Not found: {0}")] - NotFound(String), - - #[error("Not local machine: {0}")] - NotLocal(String), - - #[error("Not remote machine: {0}")] - NotRemote(String), - - #[error("Pool already exists: {0}")] - PoolAlreadyExists(String), - - #[error("Protocol error: {0}")] - Protocol(String), - - #[error("Serialization error: {0}")] - Serialization(String), - - #[error("Timeout: {0}")] - Timeout(String), - - #[error("Unsupported operation: {0}")] - Unsupported(String), -} - -impl From for TcpTargetError { - fn from(error: io::Error) -> Self { - TcpTargetError::Io(error.to_string()) - } -} - -impl From for TcpTargetError { - fn from(error: serde_json::Error) -> Self { - TcpTargetError::Serialization(error.to_string()) - } -} - -impl From<&str> for TcpTargetError { - fn from(value: &str) -> Self { - TcpTargetError::Protocol(value.to_string()) - } -} - -impl From for TcpTargetError { - fn from(value: String) -> Self { - TcpTargetError::Protocol(value) - } -} - -impl From for TcpTargetError { - fn from(error: rsa::errors::Error) -> Self { - TcpTargetError::Crypto(error.to_string()) - } -} - -impl From for TcpTargetError { - fn from(error: ed25519_dalek::SignatureError) -> Self { - TcpTargetError::Crypto(error.to_string()) - } -} - -impl From for TcpTargetError { - fn from(error: ring::error::Unspecified) -> Self { - TcpTargetError::Crypto(error.to_string()) - } -} - -impl From for TcpTargetError { - fn from(error: base64::DecodeError) -> Self { - TcpTargetError::Serialization(error.to_string()) - } -} - -impl From for TcpTargetError { - fn from(error: pem::PemError) -> Self { - TcpTargetError::Crypto(error.to_string()) - } -} - -impl From for TcpTargetError { - fn from(error: rmp_serde::encode::Error) -> Self { - TcpTargetError::Serialization(error.to_string()) - } -} - -impl From for TcpTargetError { - fn from(error: rmp_serde::decode::Error) -> Self { - TcpTargetError::Serialization(error.to_string()) - } -} -- cgit