use std::error::Error as StdError;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum SeaFileError {
#[error("stream connect error on '{target}': {source}")]
Connect {
target: String,
#[source]
source: Box<dyn StdError + Send + Sync>,
},
#[error("subscribe error on '{stream}': {source}")]
Subscribe {
stream: String,
#[source]
source: Box<dyn StdError + Send + Sync>,
},
#[error("receive error on '{stream}': {source}")]
Receive {
stream: String,
#[source]
source: Box<dyn StdError + Send + Sync>,
},
#[error("publish error to '{stream}': {source}")]
Publish {
stream: String,
#[source]
source: Box<dyn StdError + Send + Sync>,
},
#[error("seek error on '{stream}': {source}")]
Seek {
stream: String,
#[source]
source: Box<dyn StdError + Send + Sync>,
},
#[error("stream transport is not connected")]
NotConnected,
#[error("invalid descriptor: {0}")]
Invalid(String),
}
pub(crate) fn box_err<E>(err: E) -> Box<dyn StdError + Send + Sync>
where
E: StdError + Send + Sync + 'static,
{
Box::new(err)
}