We should take special care with error descriptions for the users (and ourselves).
TL;DR: Use meaningfull descriptions and suggest corrective actions.
- The Least Surprise Principle
Use declarative error messages
Show clear exit actions
Programmers are seldom UX experts.
We also underestimate the fact we can be on both sides of the counter.
alert("Cancel the appointment?", "Yes", "No"); //No consequences //Options not clear
alert("Cancel the appointment? \n" + "You will lose all the history", "Cancel Appointment", "Keep Editing"); //Consequences are clear //Choice options have context
We need to read all exception messages in code reviews.
We need to think in our end users when raising exception or showing messages.
While it is a known fact that programmers never make mistakes, it is still a good idea to humor the users by checking for errors at critical points in your program.
Robert D. Schneider
This article is part of the CodeSmell Series.