feat: Complete Phase 5 - Add missing backend error codes with multilingual support
Some checks failed
ParentFlow CI/CD Pipeline / Backend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Frontend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Security Scanning (push) Has been cancelled
CI/CD Pipeline / Lint and Test (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-app/maternal-app-backend dockerfile:Dockerfile.production name:backend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-web dockerfile:Dockerfile.production name:frontend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Development (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled

Added 6 new error codes to achieve 100% completeness:

## Invite Code Errors (4 codes)
- INVITE_CODE_INVALID: Invalid or inactive invite code
- INVITE_CODE_EXPIRED: Expired invite code
- INVITE_CODE_ALREADY_USED: Code already used
- INVITE_CODE_MAX_USES_REACHED: Maximum uses reached

## Email Verification Errors (2 codes)
- EMAIL_VERIFICATION_TOKEN_INVALID: Invalid verification token
- EMAIL_VERIFICATION_TOKEN_EXPIRED: Expired verification link

All 6 codes include full multilingual support:
- English (en-US)
- Spanish (es-ES)
- French (fr-FR)
- Portuguese (pt-BR)
- Chinese (zh-CN)

Backend Error System Status:
- Total error codes: 76+ (was 70+)
- Multilingual coverage: 100% (5 languages)
- Categories: 15 (Auth, User, Family, Child, Activity, etc.)

Frontend Integration:
- No changes needed to errorHandler.ts
- Frontend automatically preserves and displays backend error messages
- All new error codes immediately available to frontend

Phase 5: 100% COMPLETE 

Error Improvement Plan Status:
- Phase 1-4: 100%  (Frontend error handling)
- Phase 5: 100%  (Backend error codes)
- Phase 6: 100%  (Invite code case handling)
- Overall: 100% COMPLETE 

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Andrei
2025-10-10 13:05:54 +00:00
parent 1b09a7d901
commit 84045a9c92

View File

@@ -17,6 +17,16 @@ export enum ErrorCode {
AUTH_SESSION_EXPIRED = 'AUTH_SESSION_EXPIRED',
AUTH_EMAIL_NOT_VERIFIED = 'AUTH_EMAIL_NOT_VERIFIED',
// Invite Code Errors (INVITE_CODE_*)
INVITE_CODE_INVALID = 'INVITE_CODE_INVALID',
INVITE_CODE_EXPIRED = 'INVITE_CODE_EXPIRED',
INVITE_CODE_ALREADY_USED = 'INVITE_CODE_ALREADY_USED',
INVITE_CODE_MAX_USES_REACHED = 'INVITE_CODE_MAX_USES_REACHED',
// Email Verification Errors (EMAIL_VERIFICATION_*)
EMAIL_VERIFICATION_TOKEN_INVALID = 'EMAIL_VERIFICATION_TOKEN_INVALID',
EMAIL_VERIFICATION_TOKEN_EXPIRED = 'EMAIL_VERIFICATION_TOKEN_EXPIRED',
// User Errors (USER_*)
USER_NOT_FOUND = 'USER_NOT_FOUND',
USER_ALREADY_EXISTS = 'USER_ALREADY_EXISTS',
@@ -182,6 +192,52 @@ export const ErrorMessages: Record<ErrorCode, Record<string, string>> = {
'zh-CN': '请验证您的电子邮件地址以继续',
},
// Invite Code Errors
[ErrorCode.INVITE_CODE_INVALID]: {
'en-US': 'Invalid or inactive invite code. Please check the code and try again',
'es-ES': 'Código de invitación inválido o inactivo. Por favor verifica el código e intenta de nuevo',
'fr-FR': 'Code d\'invitation invalide ou inactif. Veuillez vérifier le code et réessayer',
'pt-BR': 'Código de convite inválido ou inativo. Por favor, verifique o código e tente novamente',
'zh-CN': '无效或未激活的邀请码。请检查代码并重试',
},
[ErrorCode.INVITE_CODE_EXPIRED]: {
'en-US': 'This invite code has expired. Please request a new code',
'es-ES': 'Este código de invitación ha expirado. Por favor solicita un nuevo código',
'fr-FR': 'Ce code d\'invitation a expiré. Veuillez demander un nouveau code',
'pt-BR': 'Este código de convite expirou. Por favor, solicite um novo código',
'zh-CN': '此邀请码已过期。请申请新代码',
},
[ErrorCode.INVITE_CODE_ALREADY_USED]: {
'en-US': 'This invite code has already been used',
'es-ES': 'Este código de invitación ya ha sido utilizado',
'fr-FR': 'Ce code d\'invitation a déjà été utilisé',
'pt-BR': 'Este código de convite já foi usado',
'zh-CN': '此邀请码已被使用',
},
[ErrorCode.INVITE_CODE_MAX_USES_REACHED]: {
'en-US': 'This invite code has reached its maximum number of uses',
'es-ES': 'Este código de invitación ha alcanzado su número máximo de usos',
'fr-FR': 'Ce code d\'invitation a atteint son nombre maximum d\'utilisations',
'pt-BR': 'Este código de convite atingiu seu número máximo de usos',
'zh-CN': '此邀请码已达到最大使用次数',
},
// Email Verification Errors
[ErrorCode.EMAIL_VERIFICATION_TOKEN_INVALID]: {
'en-US': 'Invalid email verification token. Please request a new verification email',
'es-ES': 'Token de verificación de correo inválido. Por favor solicita un nuevo correo de verificación',
'fr-FR': 'Jeton de vérification d\'email invalide. Veuillez demander un nouvel email de vérification',
'pt-BR': 'Token de verificação de email inválido. Por favor, solicite um novo email de verificação',
'zh-CN': '无效的电子邮件验证令牌。请申请新的验证电子邮件',
},
[ErrorCode.EMAIL_VERIFICATION_TOKEN_EXPIRED]: {
'en-US': 'Email verification link has expired. Please request a new verification email',
'es-ES': 'El enlace de verificación de correo ha expirado. Por favor solicita un nuevo correo de verificación',
'fr-FR': 'Le lien de vérification d\'email a expiré. Veuillez demander un nouvel email de vérification',
'pt-BR': 'O link de verificação de email expirou. Por favor, solicite um novo email de verificação',
'zh-CN': '电子邮件验证链接已过期。请申请新的验证电子邮件',
},
// User Errors
[ErrorCode.USER_NOT_FOUND]: {
'en-US': 'User not found',