1pub use perfgate_error::AuthError;
4use thiserror::Error;
5
6#[derive(Debug, Error)]
8pub enum StoreError {
9 #[error("Baseline already exists: {0}")]
11 AlreadyExists(String),
12
13 #[error("Baseline not found: {0}")]
15 NotFound(String),
16
17 #[error("Database connection error: {0}")]
19 ConnectionError(String),
20
21 #[error("Query error: {0}")]
23 QueryError(String),
24
25 #[error("Serialization error: {0}")]
27 SerializationError(#[from] serde_json::Error),
28
29 #[error("IO error: {0}")]
31 IoError(#[from] std::io::Error),
32
33 #[error("SQLite error: {0}")]
35 SqliteError(#[from] rusqlite::Error),
36
37 #[error("Lock error: {0}")]
39 LockError(String),
40
41 #[error("{0}")]
43 Other(String),
44}
45
46impl StoreError {
47 pub fn already_exists(project: &str, benchmark: &str, version: &str) -> Self {
49 Self::AlreadyExists(format!(
50 "project={}, benchmark={}, version={}",
51 project, benchmark, version
52 ))
53 }
54
55 pub fn not_found(project: &str, benchmark: &str, version: &str) -> Self {
57 Self::NotFound(format!(
58 "project={}, benchmark={}, version={}",
59 project, benchmark, version
60 ))
61 }
62}
63
64#[derive(Debug, Error)]
66pub enum ConfigError {
67 #[error("Invalid configuration: {0}")]
69 InvalidValue(String),
70
71 #[error("Missing required configuration: {0}")]
73 MissingRequired(String),
74
75 #[error("Configuration file error: {0}")]
77 FileError(#[from] std::io::Error),
78
79 #[error("Configuration parse error: {0}")]
81 ParseError(String),
82}