feat: migrate fetch captcha config to use db_*

This commit is contained in:
realaravinth
2022-05-27 18:16:47 +05:30
parent 3a535c04a6
commit cd72ae6ffe
10 changed files with 45 additions and 113 deletions

View File

@@ -240,20 +240,20 @@ impl From<CaptchaError> for ServiceError {
}
}
#[cfg(not(tarpaulin_include))]
impl From<sqlx::Error> for ServiceError {
#[cfg(not(tarpaulin_include))]
fn from(e: sqlx::Error) -> Self {
use sqlx::error::Error;
use std::borrow::Cow;
if let Error::Database(err) = e {
if err.code() == Some(Cow::from("23505")) {
return ServiceError::UsernameTaken;
}
}
ServiceError::InternalServerError
}
}
//#[cfg(not(tarpaulin_include))]
//impl From<sqlx::Error> for ServiceError {
// #[cfg(not(tarpaulin_include))]
// fn from(e: sqlx::Error) -> Self {
// use sqlx::error::Error;
// use std::borrow::Cow;
// if let Error::Database(err) = e {
// if err.code() == Some(Cow::from("23505")) {
// return ServiceError::UsernameTaken;
// }
// }
// ServiceError::InternalServerError
// }
//}
#[cfg(not(tarpaulin_include))]
impl From<SmtpError> for ServiceError {