palladium_http/error.rs
1use std::io;
2
3/// Errors produced by [`HttpListener`](crate::HttpListener).
4#[derive(Debug)]
5pub enum HttpError {
6 /// Failed to bind the TCP listener.
7 Bind(io::Error),
8}
9
10impl std::fmt::Display for HttpError {
11 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12 match self {
13 HttpError::Bind(e) => write!(f, "HTTP listener bind error: {e}"),
14 }
15 }
16}
17
18impl std::error::Error for HttpError {
19 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
20 match self {
21 HttpError::Bind(e) => Some(e),
22 }
23 }
24}