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".
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!
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.
Now scan your code and look for places where you create error messages. Do they carry both a 'finger' as well as a 'tell'?