Sub topic 6
Kinds of Errors Users Meet
Assume you know basic UI design terms and how an application fetches data asynchronously. This chapter focuses on classifying errors so that each one gets the right message and recovery path. An error is not only a technical event. It is a change in what the user can do next.
Classify the cause before writing the message
Start by asking two questions:
- Who can fix the problem?
- Can the user continue without changing anything?
These questions separate errors that may look similar in code but need different UI treatment. A failed request might mean the user is offline, lacks permission, requested an item that no longer exists, or triggered a server failure. “Something went wrong” hides these differences.
| Error kind | Likely cause | What the user needs |
|---|---|---|
| Validation | The submitted value is missing or invalid | A precise correction |
| Authentication | The session is missing or expired | Sign in again |
| Authorization | The account lacks access | An explanation or access request |
| Not found | The requested resource does not exist | A way back or another resource |
| Network or transient | The connection failed or a service is briefly unavailable | Retry and preserved work |
| Conflict | Data changed or an action duplicates existing data | Review and choose what to keep |
| Server or system | The application failed while processing a valid request | Retry later or use a fallback |
| Partial failure | Some independent operations succeeded and others failed | See what worked and retry only what did not |
Validation errors
A validation error occurs when an input cannot be accepted. It is usually recoverable immediately because the user can change the value.
Place the message near the relevant field. Say what is wrong and how to fix it:
- “Enter a project name.”
- “Use a valid email address.”
- “The password must contain at least 12 characters.”
Avoid blaming the user. “Invalid input” gives no useful direction. If several fields fail, keep each message attached to its field and provide a short summary when necessary.
Client-side validation can provide quick feedback, but the server must validate too. A request can be changed after it leaves the browser, and server rules may be stricter than client rules.
Authentication and authorization errors
Authentication answers, “Who are you?” Authorization answers, “Are you allowed to do this?”
An authentication error often means that a session expired. Preserve unsaved work where possible, explain that the session ended, and provide a sign-in action. Do not silently send the user to a generic error page.
An authorization error means the user is signed in but lacks permission. “You do not have permission” is only useful if the interface also explains the next step, such as contacting an administrator or requesting access. Do not offer a retry button when the same account will receive the same denial.
Not-found errors
A not-found error means the requested resource is unavailable at that address. It may have been deleted, moved, or never existed. The best recovery depends on the context:
- On a detail page, link to the parent list.
- In search results, suggest changing the query.
- After a deletion, explain that the item no longer exists and offer a relevant destination.
Do not treat every missing item as a system failure. The server may be working correctly.
Network and transient errors
A network error means the client could not complete communication. The cause may be a disconnected device, a timeout, or a temporary service problem. The user often needs a retry action, but the interface should also protect their work.
A transient error is likely to succeed later. Use language such as “We couldn’t load your projects. Check your connection and try again.” Avoid promising that retrying will definitely work.
When a save fails, keep the entered data visible. If an operation is safe to repeat, retrying may be automatic. For an operation that could create duplicates, require confirmation or use an idempotency key, which is a request identifier that lets the server recognize repeated attempts as the same operation.
Conflicts and partial failures
A conflict occurs when the requested change no longer matches current data. For example, two people may edit the same record. Explain that the data changed and let the user compare, reload, or choose which version to keep.
Some screens perform several independent operations. If three files upload and one fails, do not replace the whole screen with one error. Show the successful uploads, identify the failed file, and provide a retry for that file only.
A practical error review
For each failed operation, record:
- The event that failed.
- The most likely cause.
- Whether the user can fix it.
- Whether retrying is safe.
- What information must remain visible.
- Where focus should move after the error.
This produces more useful designs than choosing one global error component. The same HTTP status can also need different treatment depending on the operation. A 404 while loading a deleted document differs from a 404 for a mistyped search route.
Exercise
A user submits a form, but the server reports that the record was changed by someone else. Which error category is this, and what recovery should the interface offer?
Show answer
It is a conflict error. Keep the user’s edits, explain that the record changed, and offer options such as comparing versions, reloading the current record, or choosing which changes to keep.