#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("serialization error: {0}")]
Codec(#[from] serde_json::Error),
#[error("protocol error: {0}")]
Protocol(String),
#[error("frame of {len} bytes exceeds the {max}-byte limit")]
FrameTooLarge {
len: usize,
max: usize,
},
#[error("session format {theirs} is not the supported {ours}")]
VersionMismatch {
ours: u32,
theirs: u32,
},
#[error("replication error: {0}")]
Sync(String),
#[error("the stream closed")]
Closed,
#[error("the peer refused the session: {0}")]
Refused(String),
}
pub type Result<T> = std::result::Result<T, Error>;