feat: Complete Phase 4 error handling improvements for settings and onboarding
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
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 / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled

- Update settings page to use extractError() utility for consistent error messages
- Update onboarding page family creation/join with improved error handling
- Both pages now use centralized error extraction for user-friendly messages
- Preserves multilingual error messages from backend

Phase 4 Progress: 17/~20 forms completed (85%)
-  Auth forms (login, register, forgot-password)
-  Family & child management
-  All 6 activity tracking forms
-  Settings page (NEW)
-  Onboarding flow (NEW)
- Note: Analytics/AI pages skipped - already have adequate error handling
- Note: PhotoUpload component skipped - already has proper error handling

Error improvement plan: ~85% complete (Phase 1-4 mostly done)

🤖 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 12:35:25 +00:00
parent 51057a3d26
commit 28dd8852af
2 changed files with 8 additions and 3 deletions

View File

@@ -40,6 +40,7 @@ import { useTheme } from '@mui/material/styles';
import { StepIconProps } from '@mui/material/StepIcon';
import { FamilySetupStep, ChildData } from '@/components/onboarding/FamilySetupStep';
import { familiesApi } from '@/lib/api/families';
import { extractError } from '@/lib/utils/errorHandler';
const steps = ['Welcome', 'Preferences', 'Family Setup', 'Complete'];
@@ -230,7 +231,8 @@ export default function OnboardingPage() {
setActiveStep((prev) => prev + 1);
} catch (err: any) {
console.error('Failed to create family:', err);
setError(err.response?.data?.message || 'Failed to create family. Please try again.');
const errorData = extractError(err);
setError(errorData.userMessage || errorData.message);
} finally {
setLoading(false);
}
@@ -246,7 +248,8 @@ export default function OnboardingPage() {
setActiveStep((prev) => prev + 1);
} catch (err: any) {
console.error('Failed to join family:', err);
setError(err.response?.data?.message || 'Failed to join family. Please check the code and try again.');
const errorData = extractError(err);
setError(errorData.userMessage || errorData.message);
} finally {
setLoading(false);
}

View File

@@ -18,6 +18,7 @@ import { MeasurementUnitSelector } from '@/components/settings/MeasurementUnitSe
import { TimeZoneSelector } from '@/components/settings/TimeZoneSelector';
import { TimeFormatSelector } from '@/components/settings/TimeFormatSelector';
import { PhotoUpload } from '@/components/common/PhotoUpload';
import { extractError } from '@/lib/utils/errorHandler';
import { motion } from 'framer-motion';
import { useTranslation } from '@/hooks/useTranslation';
import { useThemeContext } from '@/contexts/ThemeContext';
@@ -103,7 +104,8 @@ export default function SettingsPage() {
} catch (err: any) {
console.error('❌ Failed to save settings:', err);
console.error('Error response:', err.response);
setError(err.response?.data?.message || err.message || 'Failed to save settings. Please try again.');
const errorData = extractError(err);
setError(errorData.userMessage || errorData.message);
} finally {
setIsLoading(false);
}