fix: add error for email verification
This commit is contained in:
parent
64eea68a84
commit
ea5a97c613
|
@ -202,7 +202,7 @@ func (s AccountServiceDefault) VerifyEmail(email string, token string) error {
|
|||
|
||||
if result.Error != nil {
|
||||
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return NewAccountError(ErrKeyUserNotFound, result.Error)
|
||||
return NewAccountError(ErrKeyEmailVerificationFailed, result.Error)
|
||||
}
|
||||
|
||||
return NewAccountError(ErrKeyDatabaseOperationFailed, result.Error)
|
||||
|
|
|
@ -27,6 +27,7 @@ const (
|
|||
// Account update errors
|
||||
ErrKeyAccountUpdateFailed = "ErrAccountUpdateFailed"
|
||||
ErrKeyAccountAlreadyVerified = "ErrAccountAlreadyVerified"
|
||||
ErrKeyEmailVerificationFailed = "ErrEmailVerificationFailed"
|
||||
|
||||
// JWT generation errors
|
||||
ErrKeyJWTGenerationFailed = "ErrJWTGenerationFailed"
|
||||
|
@ -75,6 +76,7 @@ var defaultErrorMessages = map[string]string{
|
|||
// Account update errors
|
||||
ErrKeyAccountUpdateFailed: "Failed to update account information.",
|
||||
ErrKeyAccountAlreadyVerified: "Account is already verified.",
|
||||
ErrKeyEmailVerificationFailed: "Failed to verify email address.",
|
||||
|
||||
// JWT generation errors
|
||||
ErrKeyJWTGenerationFailed: "Failed to generate a new JWT token.",
|
||||
|
@ -122,6 +124,7 @@ var (
|
|||
// Account update errors
|
||||
ErrKeyAccountUpdateFailed: http.StatusInternalServerError,
|
||||
ErrKeyAccountAlreadyVerified: http.StatusConflict,
|
||||
ErrKeyEmailVerificationFailed: http.StatusInternalServerError,
|
||||
|
||||
// JWT generation errors
|
||||
ErrKeyJWTGenerationFailed: http.StatusInternalServerError,
|
||||
|
|
Loading…
Reference in New Issue