naia_server_socket/
error.rs

1use std::{error::Error, fmt, net::SocketAddr};
2
3/// An Error type specifically related to the Naia Server Socket
4/// This is under construction and needs to be cleaned up
5#[derive(Debug)]
6pub enum NaiaServerSocketError {
7    /// A wrapped error from another library/codebase
8    Wrapped(Box<dyn Error + Send + Sync>),
9    /// An error indicating an inability to send to the given address
10    SendError(SocketAddr),
11}
12
13impl fmt::Display for NaiaServerSocketError {
14    fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
15        match self {
16            NaiaServerSocketError::Wrapped(boxed_err) => fmt::Display::fmt(boxed_err.as_ref(), f),
17            NaiaServerSocketError::SendError(addr) => fmt::Display::fmt(&addr, f),
18        }
19    }
20}
21
22impl Error for NaiaServerSocketError {}