Server Actions có thể throw errors sẽ được catch bởi nearest error.tsx.
- Với useFormState/useActionState, return error object thay vì throw:
return { error: 'Invalid input' }. - Dùng try/catch trong action để handle expected errors (validation, not found) và return user-friendly error states.