rustchat/src/chat_error.rs

19 lines
463 B
Rust

#[derive(Debug)]
pub enum ChatError {
IOError(std::io::Error),
MutexPoisonError(),
Protocol(String),
}
impl From<std::io::Error> for ChatError {
fn from(error: std::io::Error) -> Self {
ChatError::IOError(error)
}
}
impl<'a, T> From<std::sync::PoisonError<std::sync::MutexGuard<'a, T>>> for ChatError {
fn from(_error: std::sync::PoisonError<std::sync::MutexGuard<'a, T>>) -> Self {
ChatError::MutexPoisonError()
}
}