Files
foxhunt/services/api/src/error.rs
jgrusewski e50ea55064 feat: create services/api/ — unified gRPC gateway with tonic-web
Copied from api_gateway, removed REST handlers (port 8080),
added tonic-web + CORS for grpc-web browser access.
Binary renamed: api-gateway → api

Changes:
- Package name: api-gateway → api
- Deleted src/handlers/ (REST ML endpoints on port 8080)
- Added tonic-web 0.13 + tower-http CORS layer
- Server::builder().accept_http1(true) for grpc-web
- CORS_ORIGINS env var (default http://localhost:5173)
- Metrics server on port 9091 (axum) preserved
- All 95 lib tests pass, 0 clippy warnings
- Added services/api to workspace members

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 23:32:46 +01:00

32 lines
815 B
Rust

//! Error types for API Gateway configuration management
use thiserror::Error;
/// Configuration management errors
#[derive(Debug, Error)]
pub enum GatewayConfigError {
#[error("Database error: {0}")]
Database(#[from] sqlx::Error),
#[error("Redis error: {0}")]
Redis(#[from] redis::RedisError),
#[error("Validation error: {0}")]
Validation(String),
#[error("Configuration not found: {service_scope}/{key}")]
NotFound { service_scope: String, key: String },
#[error("Serialization error: {0}")]
Serialization(#[from] serde_json::Error),
#[error("Internal error: {0}")]
Internal(String),
#[error("Unauthorized: {0}")]
Unauthorized(String),
}
/// Result type for configuration operations
pub type GatewayConfigResult<T> = Result<T, GatewayConfigError>;