hyperi_rustlib/http_server/error.rs
1// Project: hyperi-rustlib
2// File: src/http_server/error.rs
3// Purpose: HTTP server error types
4// Language: Rust
5//
6// License: BUSL-1.1
7// Copyright: (c) 2026 HYPERI PTY LIMITED
8
9//! HTTP server error types.
10
11use std::io;
12use thiserror::Error;
13
14/// Errors that can occur when running the HTTP server.
15#[derive(Debug, Error)]
16pub enum HttpServerError {
17 /// Failed to bind to the specified address.
18 #[error("failed to bind to {address}: {source}")]
19 Bind {
20 address: String,
21 #[source]
22 source: io::Error,
23 },
24
25 /// Failed to load TLS configuration.
26 #[error("failed to load TLS configuration: {0}")]
27 TlsConfig(String),
28
29 /// Server encountered an I/O error.
30 #[error("server I/O error: {0}")]
31 Io(#[from] io::Error),
32
33 /// Graceful shutdown timed out.
34 #[error("graceful shutdown timed out after {timeout_secs}s")]
35 ShutdownTimeout { timeout_secs: u64 },
36
37 /// Server error during operation.
38 #[error("server error: {0}")]
39 Server(String),
40}