use thiserror::Error;
#[derive(Debug, Clone, Copy, Error)]
#[error("outbound channel closed")]
pub struct SendError;
#[derive(Debug, Clone, Copy, Error)]
pub enum CallError {
#[error("response dropped")]
ResponseDropped,
#[error("timed out waiting for response")]
Timeout,
#[error("outbound channel closed")]
ChannelClosed,
}
#[derive(Debug, Clone, Copy, Error)]
#[error("inbound channel closed")]
pub struct RecvError;
#[derive(Debug, Clone, Copy, Error)]
#[error("disconnected")]
pub struct DisconnectionError;
#[cfg(feature = "server")]
#[derive(Debug, Error)]
pub enum ServerError {
#[error("missing or invalid session ID")]
InvalidSessionId,
#[error("session not found")]
SessionNotFound,
#[error("request body too large")]
BodyTooLarge,
#[error("channel send error")]
ChanSend,
#[error("handshake produced no response")]
HandshakeNoResponse,
#[error("handshake has no challenge bytes")]
HandshakeNoChallenge,
#[error(transparent)]
HttpBuild(#[from] hyper::http::Error),
}
#[derive(Debug, Error)]
pub enum ClientError {
#[error("HTTP request error: {0}")]
Request(alloc::string::String),
#[error("unexpected status {status}: {body}")]
UnexpectedStatus {
status: u16,
body: alloc::string::String,
},
#[error("handshake decode error: {0}")]
HandshakeDecode(alloc::string::String),
#[error("handshake rejected: {reason}")]
HandshakeRejected {
reason: alloc::string::String,
},
#[error("authentication error: {0}")]
Authentication(alloc::string::String),
}