What is the proper response to lousy error message?

Posted by William Pursell on Programmers See other posts from Programmers or by William Pursell
Published on 2011-06-29T15:37:42Z Indexed on 2011/06/29 16:30 UTC
Read the original article Hit count: 272

Filed under:

I've just come across (for the 47 millionth time) some code that looks like this:

except IOError, e:
  print "Problems reading file: %s." % filename
  sys.exit( 1 )

My first reaction is very visceral: the person who coded this is a complete idiot. How hard is it to print error messages to stderr and to include the system error message in the string? I haven't used python in years, and it took me all of 4 minutes to track down the documentation to figure out how to get the error message from the exception object e and the syntax for printing to stderr. My "complete idiot" reaction was slightly lessened since at least a non-zero value is passed to sys.exit, but I still find this code offensive. My prime thought is that the developer who wrote this is a complete novice for whom I have zero respect. Am I over-reacting? Surely there are excuses for all sorts of bad coding practices, but is there anything that can possibly excuse this sort of $#|t?

I guess there are two question here: one is a duplicate of What are developer's problems with helpful error messages?, and the other is "am I over-reacting, or is it valid to conclude that the author of the above code is a novice?"

© Programmers or respective owner

Related posts about error-messages