toekn not found and OAS: domains

This commit is contained in:
realaravinth
2021-03-31 13:05:33 +05:30
parent e0dab001aa
commit 8ca3729dea
3 changed files with 258 additions and 3 deletions

View File

@@ -198,10 +198,14 @@ 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