1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::io::Error as IoError;

#[derive(thiserror::Error, Debug)]
pub enum SocketError {
    #[error("socket {msg}")]
    Io { source: IoError, msg: String },
    #[error("Socket closed")]
    SocketClosed,
}

impl From<IoError> for SocketError {
    fn from(err: IoError) -> Self {
        SocketError::Io {
            source: err,
            msg: "".to_string(),
        }
    }
}