What makes a good error message?

No one enjoys receiving errors messages, but software that fails silently or proceeds with the wrong assumptions is even worse.

Errors are encountered by real users with real goals. The error message is a communication method to help the user continue their goal.

3 questions for every error

  • WHY the program could not proceed?
    Context about the goal of the process being executed and why the situation is an error. If the error is due to user input or data from other systems, ensure to include it in the error message. Sometimes user doesn’t provide the input in the right format or the system picks or parses the wrong input. Announce your assumptions for the error.
  • HOW the error was detected?
    A map for finding the root cause and inspecting more. Stack trace, error code or even a state dump is very useful.
  • WHAT can be done to resolve it?
    Suggestions for recovering or taking an alternative path to the goal. If this is a typical error, mention one or more alternatives that can usually help solve the issue. If you have support channels make sure to include them as well.
  • WHERE did the error happen?
    This provides useful context information for the developers trying to trace and/or reproduce the error.
  • WHEN did the error happen?
    Usually a form of timestamp. This information can help correlate the error to failures in other systems while inspecting the root cause.
  • WHO was trying to achieve the goal?
    Usually some form of identification like user id, session id or even user name. This data might be subjected to GDPR regulation, see my other articles introducing GDPR and pseudonymization techniques.




Sr. Staff Engineer, Knowledge Worker, MSc Systems Engineering, Tech Lead, Web Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Web3 Rabbit Hole Roundup // Week 2: DAO Platforms, Etc.

Original art with rabbit coming out of rabbit hole with series title "Web3 Rabbit Hole Roundup

New book: ‘Getting started with Bicep’ now available!

Store your Terraform state file remotely on AWS S3.

READ/DOWNLOAD^ C Primer Plus (6th Edition) (Developer’s Library) FULL BOOK PDF & FULL AUDIOBOOK

Designing User Experience for RPA based solutions

RPA UX design Roadmap

A guide to choosing your next front-end

Building A New Business From The Ground Up — TheCork.ie (News & Entertainment)

Learning Swift and iOS Development Part 5: Arrays

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alex Ewerlöf

Alex Ewerlöf

Sr. Staff Engineer, Knowledge Worker, MSc Systems Engineering, Tech Lead, Web Developer

More from Medium

Flaky (as a good pastry) tests.

Testing Under the Hood Or Behind the Wheel

I would like to be this 3rd donkey

Software migrations and Best Practices