Error Handling Checklist
Every error must be shown to the user. No error stays only in the console. No form resets after a failed submission. Every error has a human-readable message and a clear next step.
Demo 1 — Field-Level Error
Click “Trigger Field Error” to show an inline field error beneath the input. Click “Clear Error” or start typing to dismiss it.
Demo 2 — Form Banner Error
Click “Trigger API Error” to show a persistent red banner at the top of the form. Dismiss it with the × button.
Demo 3 — Page-Level Error
Toggle between normal data view and error states. Retry simulates recovering from the error after 1.2 seconds.
Something went wrong.
We couldn't load your projects. This is our fault, not yours.
No internet connection.
Check your connection and try again. Your unsaved data is still here.
Error Types & Where They Appear
| Error Type | Source | Where to Show |
|---|---|---|
| Required field empty | Client validation | Inline below the field |
| Invalid format | Client validation | Inline below the field |
| Business rule failure | API response | Inline field or form banner |
| API server error | API response | Form banner or error toast |
| Network failure | Browser/fetch | Toast or inline banner |
| Session expired | API response | Redirect to login with message |
API Error Code → User Message Mapping
Map every API error code to a plain-English message before displaying it. Never show raw codes or stack traces.
| Error Code | HTTP Status | User-Facing Message |
|---|---|---|
AUTH_REQUIRED |
401 | Please log in to continue. |
FORBIDDEN |
403 | You don't have permission to do this. |
NOT_FOUND |
404 | This record no longer exists. |
VALIDATION_ERROR |
422 | Shows field-level errors inline. |
SERVER_ERROR |
500 | Something went wrong. Please try again. |
NETWORK_ERROR |
— | Check your internet connection. |
