use thiserror::Error;
#[derive(Error, Debug)]
pub enum TransportError {
#[error("Connection failed: {0}")]
ConnectionFailed(String),
#[error("Protocol error: {0}")]
ProtocolError(String),
#[error("Invalid message format: {0}")]
InvalidMessage(String),
#[error("Session not found: {0}")]
SessionNotFound(String),
#[error("Session expired: {0}")]
SessionExpired(String),
#[error("Origin validation failed: {0}")]
OriginValidationFailed(String),
#[error("Stream error: {0}")]
StreamError(String),
#[error("Serialization error: {0}")]
SerializationError(#[from] serde_json::Error),
#[error("IO error: {0}")]
IoError(#[from] std::io::Error),
#[error("Timeout: {0}")]
Timeout(String),
#[error("Invalid cursor: {0}")]
InvalidCursor(String),
#[error("Authentication failed: {0}")]
AuthenticationFailed(String),
#[error("Authorization failed: {0}")]
AuthorizationFailed(String),
#[error("Rate limit exceeded")]
RateLimitExceeded,
#[error("Internal error: {0}")]
Internal(String),
}
pub type Result<T> = std::result::Result<T, TransportError>;