Skip to main content

zeph_gateway/
error.rs

1// SPDX-FileCopyrightText: 2026 Andrei G <bug-ops>
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4use thiserror::Error;
5
6/// Errors that can be returned by the HTTP gateway.
7///
8/// All variants implement [`std::error::Error`] via [`thiserror`].
9#[derive(Debug, Error)]
10pub enum GatewayError {
11    /// The server could not bind to the requested address.
12    ///
13    /// The first field is the address string (e.g. `"127.0.0.1:8080"`) and the
14    /// second is the underlying I/O error.
15    #[error("failed to bind {0}: {1}")]
16    Bind(String, std::io::Error),
17
18    /// The `axum` server returned a fatal error after binding succeeded.
19    ///
20    /// This typically indicates a listener failure or an OS-level socket error.
21    #[error("server error: {0}")]
22    Server(String),
23}