use tokio::sync::mpsc::error::TrySendError;
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("Subscription not found")]
NoSubscription,
#[error("Parsing Error {0}")]
ParsingError(String),
#[error("Internal")]
Internal(Box<dyn std::error::Error + Send + Sync>),
#[error("Internal error {0}")]
InternalStr(String),
#[error("Not supported")]
NotSupported,
#[error("Channel is full")]
ChannelFull,
#[error("Channel is close")]
ChannelClosed,
}
impl<T> From<TrySendError<T>> for Error {
fn from(value: TrySendError<T>) -> Self {
match value {
TrySendError::Closed(_) => Error::ChannelClosed,
TrySendError::Full(_) => Error::ChannelFull,
}
}
}