19 lines
464 B
Rust
19 lines
464 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()
|
||
|
}
|
||
|
}
|