use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, Error)]
pub enum Error {
#[error("connection closed")]
Closed,
#[error("invalid url: {0}")]
InvalidUrl(String),
#[error("protocol error: {0}")]
Protocol(String),
#[error("io error: {0}")]
Io(String),
#[error("tls error: {0}")]
Tls(String),
#[error("unsupported: {0}")]
Unsupported(String),
#[error("frame decode error: {0}")]
FrameDecode(String),
#[error("stream id error: {0}")]
StreamId(String),
#[error("other error: {0}")]
Other(String),
}
impl Error {
pub fn other<E: std::fmt::Display>(e: E) -> Self {
Self::Other(e.to_string())
}
}