Writing Helpful Error Messages During Software Development

How would you react when you see this while installing Windows 10 on your machine?

This leaves you without an idea about what to do next – a symptom of one of the worst error messages to show to a user.

Error messages should be helpful and informative and should tell the user about what exactly has happened and what to do next. Neither too much information nor too little is something that would make a good error message.

Most software engineers concentrate more on performance and less on user experience. However, a good developer is one who can see both sides of the coin. While it is important to keep performance of your code up to the mark, it is even more important to interact well with the user through your software. This results in less customer support calls and in case you get any, your support team knows how to resolve this.

A few days I was at billdesk.com when I encountered this when I right clicked on a payment page:

Screenshot from 2015-09-12 11:36:49

One word with three dots makes me think about person who wrote this javascript alert statement. Surely must be someone working in a services company because I don’t think billdesk builds its own software.

The worst part is that the right click actually works after the alert dialog is shown. Weird? Well, it looks like the developer had written the code to disable it, but it doesn’t work. The code on the site is this:

document.onmousedown=disableclick;
status="Right Click Disabled";
function disableclick(event)
{
  if(event.button==2)
   {
     alert(status);
     return false;    
   }
}

The above code doesn’t work. here’s the one that works for new browsers:

document.addEventListener("contextmenu", function(e){
    e.preventDefault();
}, false);

Billdesk doesn’t really seem to be bothered about this, but I guess it wouldn’t be a tough job to hack the site. And please, no one word error messages please!!

Leave a Reply