A quick note on error messages

I went to a local museum yesterday and when the attendant scanned by membership card his computer said:

Object not set to a reference of an object.

Because we're programmers, you and I know what that means (more or less), but the poor attendant hasn't got a clue. The message may as well have said:

There's an error and I'm not going to tell you what went wrong or what to do about it! Ha, ha, ha!

Of course the attendant had seen this message before, probably hundreds of times, so he knew what to do and scanned my membership card again at a different speed holding it slightly differently. It worked the second time.

The point of the story is that you should never display an error message like this one to a user. They don't know what it means and don't know how to try to fix the problem. You may as well just insult the user and get it over with.

Whenever I see a message like this in an application I'm using, I think, "What a piece of garbage. A beginning programmer could have anticipated this error and displayed a better message than this." Do you really want the user to think of your program as a piece of garbage (or worse) every time they use it?

In my trip yesterday, it was obvious that this error occurs frequently so displaying such a bad message is even less forgivable.

The moral is, you should always catch errors (with a try-catch block in C#) and display something meaningful to the user. Even if you can't really tell specifically what went wrong, give the user a general idea of what went wrong. If possible, include a suggestion of something to try that might fix it. In this case a much better message would be:

Error scanning membership card. Please try again or enter the membership number manually.

See? Even not knowing exactly what was going wrong in the software, I can come up with a meaningful and constructive error message.

 

What did you think of this article?




Trackbacks
  • No trackbacks exist for this post.
Comments

  • 12/31/2012 1:29 PM John Bisschop wrote:
    Rod, I know exactly what you are talking about! I always try to give the user an accurate error message when something wrong occurs in my programs. When seeing a bad message, my first reaction is the same as yours! I just think "Sloppy programming!" With a little effort, you can make the program a lot friendlier for the user.
    Reply to this
Leave a comment

Submitted comments are subject to moderation before being displayed.

 Name

 Email (will not be published)

 Website

Your comment is 0 characters limited to 3000 characters.