use thiserror::Error;
#[derive(Error, Debug)]
pub enum HyperInferError {
#[error("Configuration error: {0}")]
Config(#[from] std::io::Error),
#[error("Rate limiting error: {0}")]
RateLimit(String),
#[error("HTTP request failed: {0}")]
Http(#[from] reqwest::Error),
#[error("API error ({status}): {message}")]
ApiError { status: u16, message: String },
#[error("SSE parse error: {message}")]
StreamParse { message: String, raw: String },
#[error("Database error")]
Database(#[from] sqlx::Error),
#[error("Redis error")]
Redis(#[from] redis::RedisError),
#[error("Streaming not supported by provider: {0}")]
UnsupportedStreaming(String),
}
#[derive(Debug, Error)]
pub enum DbError {
#[error("Database error: {0}")]
Sqlx(#[from] sqlx::Error),
#[error("Invalid UUID")]
InvalidUuid,
#[error("Not found")]
NotFound,
#[error("Unique constraint violation: {0}")]
UniqueViolation(String),
#[error("Validation error: {0}")]
ValidationError(String),
}
#[derive(Debug, Error)]
pub enum ConfigError {
#[error("Redis error: {0}")]
Redis(#[from] redis::RedisError),
#[error("Serialization error: {0}")]
Serialization(#[from] serde_json::Error),
#[error("Configuration error: {0}")]
Other(String),
}