yao_dev_common/error/repo_error.rs
1use rbatis::Error;
2
3#[derive(Debug, thiserror::Error)]
4pub enum RepoError {
5 #[allow(dead_code)]
6 #[error("Database error: {0}")]
7 DatabaseError(#[from] Error), // 500
8}
9
10impl From<String> for RepoError {
11 fn from(err: String) -> Self {
12 RepoError::DatabaseError(Error::from(err))
13 }
14}
15
16impl From<&str> for RepoError {
17 fn from(err: &str) -> Self {
18 RepoError::DatabaseError(Error::from(err))
19 }
20}