use redis::RedisError;
use tokio::{sync::mpsc::error::SendError, task::JoinError};
use rsiot_messages_core::Error as MessagesError;
#[derive(Debug)]
pub enum Error {
DeserializeError(MessagesError),
RedisConnectionError(String),
SendChannelError(String),
GetMessageError,
JoinError(JoinError),
}
impl From<MessagesError> for Error {
fn from(value: MessagesError) -> Self {
Self::DeserializeError(value)
}
}
impl From<RedisError> for Error {
fn from(value: RedisError) -> Self {
Error::RedisConnectionError(value.to_string())
}
}
impl<T> From<SendError<T>> for Error {
fn from(value: SendError<T>) -> Self {
Self::SendChannelError(value.to_string())
}
}
impl From<JoinError> for Error {
fn from(value: JoinError) -> Self {
Self::JoinError(value)
}
}