Skip to content

Commit

Permalink
feat: add access resource denied error
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangxiaoqiang committed Aug 17, 2024
1 parent e988216 commit c965b4f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/model/error/infra_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ pub enum InfraError {
LoginInfoNotMatch,
#[error("验证码已过期")]
VerifyCodeExpired,
#[error("无访问资源权限")]
AccessResourceDenied,
}

impl ErrorResponse for InfraError {
Expand All @@ -27,6 +29,7 @@ impl ErrorResponse for InfraError {
InfraError::SmsVerifyCodeNotMatch => "0030010010",
InfraError::LoginInfoNotMatch => "0030010001",
InfraError::VerifyCodeExpired => "0030010011",
InfraError::AccessResourceDenied => "0030010012",
}
}

Expand All @@ -48,6 +51,9 @@ impl ErrorResponse for InfraError {
InfraError::VerifyCodeExpired => {
"验证码已过期"
},
InfraError::AccessResourceDenied => {
"无访问资源权限"
},
}
}

Expand All @@ -59,6 +65,7 @@ impl ErrorResponse for InfraError {
InfraError::SmsVerifyCodeNotMatch => "SMS_VERIFY_CODE_NOT_MATCH",
InfraError::LoginInfoNotMatch => "LOGIN_INFO_NOT_MATCH",
InfraError::VerifyCodeExpired => "VERIFY_CODE_EXPIRED",
InfraError::AccessResourceDenied => "ACCESS_RESOURCE_DENIED",
}
}
}

0 comments on commit c965b4f

Please sign in to comment.