hyperlane_core/error/impl.rs
1use super::*;
2
3/// Implements the standard error trait for [`ServerError`].
4impl Error for ServerError {}
5
6/// Implements the standard error trait for [`RouteError`].
7impl Error for RouteError {}
8
9/// Implementation of `From` trait for converting external errors into `ServerError`.
10///
11/// This allows using the `?` operator to automatically convert `IoError`
12/// into `ServerError::TcpBind` when binding to a TCP socket.
13impl From<io::Error> for ServerError {
14 /// Creates a new `ServerError::TcpBind` instance from a `IoError`.
15 ///
16 /// # Arguments
17 ///
18 /// - `io::Error` - The `IoError` to convert.
19 ///
20 /// # Returns
21 ///
22 /// - `Self` - A new `ServerError::TcpBind` instance.
23 #[inline(always)]
24 fn from(error: io::Error) -> Self {
25 ServerError::TcpBind(error.to_string())
26 }
27}