update user secret

This commit is contained in:
realaravinth
2021-04-10 21:44:08 +05:30
parent 52ab947e3b
commit 08ec215709
4 changed files with 51 additions and 7 deletions

View File

@@ -187,16 +187,11 @@ impl From<sqlx::Error> for ServiceError {
fn from(e: sqlx::Error) -> Self {
use sqlx::error::Error;
use std::borrow::Cow;
println!("{:?}", &e);
if let Error::Database(err) = e {
if err.code() == Some(Cow::from("23505")) {
return ServiceError::UsernameTaken;
}
println!("{:?}", &err.code());
}
ServiceError::InternalServerError
}
}
@@ -204,9 +199,7 @@ impl From<sqlx::Error> for ServiceError {
pub fn dup_error(e: sqlx::Error, dup_error: ServiceError) -> ServiceError {
use sqlx::error::Error;
use std::borrow::Cow;
// println!("sqlx:Error: {:#?}", &e);
if let Error::Database(err) = e {
// println!("Database Error: {:#?}", &err);
if err.code() == Some(Cow::from("23505")) {
dup_error
} else {