Wednesday, September 06, 2006

What's An Error?

Carrying on the theme of maintainability --

I see junior developers who have apparently never been involved in the ongoing operation of an application. While everyone has to start somewhere, the result is often code with exceptions that are caught and neither logged nor acted upon alongside exceptions thrown and logged when that serves no useful purpose.

Case in point: The logging for the current project sends an email when an "Error" is logged. Yesterday I started getting these when an invalid user name was entered. Excuse me? This is an expected behavior. People will make mistakes, unauthorized people will try to gain access, a test case will enter known invalid data to make sure it doesn't get in.

A proper response would be to prompt for input again, perhaps limit the number of attempts, provide a "forgot your user name?" link -- but certainly not log this as an "Error".

The only things that should log at that level are things that require a developer to investigate.