tcp_request/request/error/
impl.rs

1use crate::*;
2
3/// Standard error implementation for RequestError.
4impl StdError for RequestError {}
5
6/// Display formatting implementation for RequestError.
7impl Display for RequestError {
8    /// Formats the error for display.
9    ///
10    /// # Arguments
11    ///
12    /// - `&mut fmt::Formatter<'_>` - The formatter to write to.
13    ///
14    /// # Returns
15    ///
16    /// - `fmt::Result` - The result of the formatting operation.
17    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18        match self {
19            Self::InvalidUrl => write!(f, "Invalid URL"),
20            Self::TcpStreamConnectError => write!(f, "TCP Stream Connection Error"),
21            Self::RequestError => write!(f, "Request Error"),
22            Self::ReadConnectionError => write!(f, "Connection Read Error"),
23            Self::SetReadTimeoutError => write!(f, "Failed to Set Read Timeout"),
24            Self::SetWriteTimeoutError => write!(f, "Failed to Set Write Timeout"),
25            Self::ReadResponseError => write!(f, "Read response error"),
26        }
27    }
28}