Skip to main content

actus_server/
error.rs

1//! [`ServerError`] — the error type returned by the server's lifecycle
2//! methods (`run`, `run_with_shutdown_on`).
3
4use actus_reply::WebError;
5use thiserror::Error;
6
7/// An error from the server itself — binding, accepting, or serving
8/// connections — as opposed to a per-request [`WebError`]. Returned by
9/// [`Server::run`](crate::server::Server::run) and friends.
10#[derive(Error, Debug)]
11pub enum ServerError {
12    /// The underlying hyper server failed (connection or protocol error).
13    #[error("Hyper server error: {0}")]
14    Hyper(#[from] hyper::Error),
15
16    /// An I/O error, typically from binding or accepting on the listener.
17    #[error("IO error: {0}")]
18    Io(#[from] std::io::Error),
19
20    /// A per-request error surfaced at the server boundary.
21    #[error("Web error: {0}")]
22    Web(#[from] WebError),
23
24    /// The provided bind address could not be parsed.
25    #[error("Failed to parse address: {0}")]
26    AddrParse(#[from] std::net::AddrParseError),
27}