pub enum ProxyError {
WebSocket(String),
AuthenticationFailed(String),
DestinationNotFound(IdentityFingerprint),
Serialization(Error),
ConnectionClosed,
InvalidMessage(String),
Io(Error),
NotConnected,
AlreadyConnected,
AuthenticationTimeout,
ChannelSendFailed,
}Expand description
Errors that can occur during proxy client or server operations.
Variants§
WebSocket(String)
WebSocket connection or communication error.
Occurs when the underlying WebSocket connection fails, including network errors, protocol violations, or connection drops.
§Example
WebSocket error: Connection refused (os error 61)AuthenticationFailed(String)
Client authentication failed.
Occurs when:
- The client’s signature verification fails
- The challenge response is invalid
- The authentication handshake times out
§Example
Authentication failed: Invalid signatureDestinationNotFound(IdentityFingerprint)
Attempted to send a message to a client that is not connected.
Occurs when sending a message to a fingerprint that:
- Never connected to the proxy
- Has disconnected
- Does not exist
§Example
Destination not found: IdentityFingerprint("abc123...")Serialization(Error)
Failed to serialize or deserialize a message.
Occurs when JSON encoding/decoding fails, usually due to:
- Corrupted message data
- Protocol version mismatch
- Invalid message format
ConnectionClosed
The WebSocket connection has been closed.
Occurs when attempting operations on a closed connection, either due to:
- Normal disconnection
- Network failure
- Server shutdown
InvalidMessage(String)
Received a message that violates the protocol.
Occurs when:
- A message is received in the wrong protocol phase
- Required authentication is missing
- Message format is invalid
§Example
Invalid message: Cannot send messages before authenticationIo(Error)
Underlying I/O operation failed.
Occurs during file operations, socket operations, or other I/O tasks.
NotConnected
Attempted an operation that requires an active connection.
Occurs when calling methods like send_to() before calling connect().
AlreadyConnected
Attempted to connect when already connected.
Occurs when calling connect() multiple times without disconnecting.
AuthenticationTimeout
Authentication handshake did not complete within the timeout period.
Occurs when the client fails to respond to the authentication challenge in time. Default timeout is implementation-defined.
ChannelSendFailed
Failed to send a message through an internal channel.
Occurs when internal message passing fails, usually because:
- The receiving end has been dropped
- The channel is closed
This typically indicates a programming error or resource cleanup issue.
Trait Implementations§
Source§impl Debug for ProxyError
impl Debug for ProxyError
Source§impl Display for ProxyError
impl Display for ProxyError
Source§impl Error for ProxyError
impl Error for ProxyError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()