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

31 lines
1.3 KiB
Go
Raw Normal View History

2026-07-10 12:54:45 +00:00
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")
ErrAlreadyBound = errors.New("already bound")
ErrInvalidPlatform = errors.New("invalid platform")
ErrOAuthFailed = errors.New("oauth verification failed")
)