atd_server_http/error.rs
1//! HTTP-listener errors.
2//!
3//! Mirrors `atd-server::ServerError` (an `std::io::Error` alias) but
4//! wraps `axum`'s `BoxError` so bind + accept-loop failures surface
5//! through a single discriminant. The variants are deliberately coarse —
6//! finer-grained categorisation (per route, per phase) can be added
7//! through a future SP without breaking the public name.
8
9use std::io;
10
11use thiserror::Error;
12
13#[derive(Debug, Error)]
14pub enum HttpServerError {
15 /// Failed to bind the listen socket (port in use, permission denied,
16 /// etc.).
17 #[error("bind {addr}: {source}")]
18 Bind {
19 addr: std::net::SocketAddr,
20 #[source]
21 source: io::Error,
22 },
23
24 /// axum::serve returned an error after binding succeeded — typically
25 /// a transient `accept()` failure or a fatal hyper error.
26 #[error("serve: {0}")]
27 Serve(#[from] io::Error),
28}