use std::io;
use std::net::SocketAddr;
use thiserror::Error;
use super::tls::TlsError;
use crate::storage::StorageError;
#[derive(Debug, Error)]
pub enum GatewayError {
#[error("TLS preflight failed: {0}")]
Tls(#[from] TlsError),
#[error("failed to load rustls TLS config: {0}")]
TlsLoad(#[source] io::Error),
#[error("failed to bind remote gateway to {addr}: {source}")]
Bind {
addr: SocketAddr,
#[source]
source: io::Error,
},
#[error("remote gateway serve loop failed: {0}")]
Serve(#[source] io::Error),
#[error("shutdown signal handler installation failed: {0}")]
Signal(#[source] io::Error),
#[error("storage backend error: {0}")]
Storage(#[source] StorageError),
}