1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum DbError {
5 #[error("Database error: {0}")]
6 SqlxError(#[from] sqlx::Error),
7
8 #[error("Serialization error: {0}")]
9 SerdeError(#[from] serde_json::Error),
10
11 #[error("Contributor not found: github_user_id={0}, repo={1}/{2}")]
12 ContributorNotFound(i64, String, String),
13
14 #[error("Credit event not found: id={0}")]
15 CreditEventNotFound(i64),
16
17 #[error("Evaluation not found: id={0}")]
18 EvaluationNotFound(String),
19
20 #[error("Repo config not found: {0}/{1}")]
21 RepoConfigNotFound(String, String),
22
23 #[error("Invalid evaluation status: {0}")]
24 InvalidStatus(String),
25}
26
27pub type DbResult<T> = Result<T, DbError>;