thread-master/apps/backend/internal/module/member/domain/errors.go

42 lines
2.0 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package domain
import "errors"
// 密碼政策文案(與 FE password.policy.hint / api.err.400003 一致)
const (
PasswordMinLen = 12
PasswordPolicyEN = "Password must be at least 12 characters with upper, lower, digit, and symbol"
PasswordPolicyZH = "密碼須至少 12 碼,且含大寫、小寫、數字與符號"
)
var (
ErrNotFound = errors.New("member not found")
ErrEmailNotRegistered = errors.New("email not registered")
ErrEmailTaken = errors.New("email already exists")
ErrPhoneTaken = errors.New("phone already exists")
ErrIdentityTaken = errors.New("login identity already bound")
ErrIdentityNotFound = errors.New("login identity not found")
ErrBadPassword = errors.New("invalid credentials")
ErrSuspended = errors.New("account suspended")
ErrUnverified = errors.New("account not verified")
ErrLastAdmin = errors.New("cannot demote or suspend the last active admin")
ErrSelfSuspend = errors.New("cannot suspend yourself")
// ErrWeakPassword — API 400003Message = PasswordPolicyEN
ErrWeakPassword = errors.New(PasswordPolicyEN)
ErrInvalidCode = errors.New("invalid or expired code")
ErrCodeRateLimited = errors.New("verification code requested too frequently")
ErrAlreadyBound = errors.New("already bound")
ErrInvalidPlatform = errors.New("invalid platform")
ErrOAuthFailed = errors.New("oauth verification failed")
// 邀請網絡message = FE i18n key invite.err.*
ErrInviteAlreadyBound = errors.New("invite.err.alreadyBound")
ErrInviteCodeRequired = errors.New("invite.err.codeRequired")
ErrInviteCodeNotFound = errors.New("invite.err.codeNotFound")
ErrInviteCodeSelf = errors.New("invite.err.codeSelf")
ErrInviteCycle = errors.New("invite.err.cycle")
ErrInviteSelfParent = errors.New("invite.err.selfParent")
ErrInviteParentMiss = errors.New("invite.err.parentNotFound")
ErrInviteNeedAdmin = errors.New("invite.err.needAdmin")
)