pub use perfgate_error::AuthError;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum StoreError {
#[error("Baseline already exists: {0}")]
AlreadyExists(String),
#[error("Baseline not found: {0}")]
NotFound(String),
#[error("Database connection error: {0}")]
ConnectionError(String),
#[error("Query error: {0}")]
QueryError(String),
#[error("Serialization error: {0}")]
SerializationError(#[from] serde_json::Error),
#[error("IO error: {0}")]
IoError(#[from] std::io::Error),
#[error("SQLite error: {0}")]
SqliteError(#[from] rusqlite::Error),
#[error("Lock error: {0}")]
LockError(String),
#[error("{0}")]
Other(String),
}
impl StoreError {
pub fn already_exists(project: &str, benchmark: &str, version: &str) -> Self {
Self::AlreadyExists(format!(
"project={}, benchmark={}, version={}",
project, benchmark, version
))
}
pub fn not_found(project: &str, benchmark: &str, version: &str) -> Self {
Self::NotFound(format!(
"project={}, benchmark={}, version={}",
project, benchmark, version
))
}
}
#[derive(Debug, Error)]
pub enum ConfigError {
#[error("Invalid configuration: {0}")]
InvalidValue(String),
#[error("Missing required configuration: {0}")]
MissingRequired(String),
#[error("Configuration file error: {0}")]
FileError(#[from] std::io::Error),
#[error("Configuration parse error: {0}")]
ParseError(String),
}