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)]
10#[non_exhaustive]
11pub enum GatewayError {
12    /// The server could not bind to the requested address.
13    ///
14    /// The first field is the address string (e.g. `"127.0.0.1:8080"`) and the
15    /// second is the underlying I/O error.
16    #[error("failed to bind {0}: {1}")]
17    Bind(String, std::io::Error),
18
19    /// The `axum` server returned a fatal error after binding succeeded.
20    ///
21    /// This typically indicates a listener failure or an OS-level socket error.
22    #[error("server error: {0}")]
23    Server(String),
24}