Engineering Notes

Designing error messages that help users recover

Explain failures clearly without leaking internal implementation details.

Anant Dhiman · · 1 min read

Comparison of confusing error messages and clearer feedback
On this page

An error message is part of the user workflow. A generic failure can leave someone uncertain whether their action succeeded, while a raw exception may reveal sensitive information.

Implementation approach

Separate user-facing error text from diagnostic details. Return a stable error code, describe what the user can do and attach a correlation identifier for support when appropriate.

Example

{"code":"UPLOAD_TOO_LARGE","message":"Choose a file smaller than 1 MB.","requestId":"req_123"}

Validation and edge cases

Test validation, permission and server failures with keyboard and screen-reader access. Preserve form input where safe, and ensure failures cannot be mistaken for successful submissions.

Key takeaway

Use logs for stack traces and internal context; user messages should remain concise, accurate and actionable.

← All insights

Related articles