fix(auth): error 类型 + auth_service 小修复
This commit is contained in:
@@ -27,6 +27,9 @@ pub enum AuthError {
|
||||
#[error("{0}")]
|
||||
Validation(String),
|
||||
|
||||
#[error("{0}")]
|
||||
Forbidden(String),
|
||||
|
||||
#[error("版本冲突: 数据已被其他操作修改,请刷新后重试")]
|
||||
VersionMismatch,
|
||||
}
|
||||
@@ -39,6 +42,7 @@ impl From<AuthError> for AppError {
|
||||
AuthError::TokenRevoked => AppError::Unauthorized,
|
||||
AuthError::UserDisabled(s) => AppError::Forbidden(s),
|
||||
AuthError::Validation(s) => AppError::Validation(s),
|
||||
AuthError::Forbidden(s) => AppError::Forbidden(s),
|
||||
AuthError::DbError(_) => AppError::Internal(err.to_string()),
|
||||
AuthError::HashError(_) => AppError::Internal(err.to_string()),
|
||||
AuthError::JwtError(_) => AppError::Unauthorized,
|
||||
|
||||
Reference in New Issue
Block a user