feat: define interface for username registration"

This commit is contained in:
realaravinth
2022-05-10 23:49:01 +05:30
parent 43aac949e3
commit 8dde022851
3 changed files with 31 additions and 1 deletions

View File

@@ -197,7 +197,12 @@ impl From<CredsError> for ServiceError {
impl From<DBError> for ServiceError {
#[cfg(not(tarpaulin_include))]
fn from(e: DBError) -> ServiceError {
ServiceError::DBError(DBErrorWrapper(e))
match e{
DBError::UsernameTaken => ServiceError::UsernameTaken,
DBError::SecretTaken => ServiceError::InternalServerError,
DBError::EmailTaken => ServiceError::EmailTaken,
_ => ServiceError::DBError(DBErrorWrapper(e))
}
}
}