Error messages should have a 'finger' and a 'tell'

Wilco Koorn

Everybody has encountered many awful error messages in his career. Text messages like "Server error", "Exception occurred", and the like or messages in a GUI box just containing some error number (if you are lucky, we have seen empty boxes as well, right?). Clearly, this not the way to present error messages to users. So let us take a look at some properties of good error messages. I present two of those good properties here: the "finger" and the "tell".

The Finger

A good error message always has what I call a 'finger'. The finger points at the location where the error occurred. For example, "syntax error on line 37" carries the finger "line 37". Note it might be very hard, or even impossible, to always provide an exact finger. Just imagine some piece of information is missing. Fine, but where to add it? Still you as a software developer should do your utmost to provide a finger to your poor user as you might have an idea, but he for sure hasn't!

The Tell

A useful error message also has a "tell". The tell tells you the most probable cause of the error and tells what to do about it. We have seen some nice examples in frameworks like Hibernate and Spring in the line of "did you perhaps forget to…." or "did you define a setter for property…". This is the spirit as in many occasions it cuts down time for analyzing what is wrong to a mere couple of seconds.

Conclusion

Now scan your code and look for places where you create error messages. Do they carry both a 'finger' as well as a 'tell'?

Comments (1)

  1. David Baakman - Reply

    August 8, 2013 at 9:58 pm

    An interesting 'tell' I was introduced to recently, was a wiki page. Each errormessage in the application included a link to a wiki page (one per errorcode) that could contain more information, and could be edited by anyone. By using this indirection you don't have to hardcode your tells in your application at deploytime.

Add a Comment