Thursday, June 22, 2006

 

Unanticipated errors

Sometimes when you program you feel forced to handle certain failure scenarios. Even more so in the case of Java's checked exceptions.
Have you had something similar to:

try {
  doWork();
} catch (MyAppException m) {
  handleMyExceptions();
} catch (SomeOtherObscureCheckedException s) {
  //This is really not supposed to happen!
  s.printStackTrace();
}


I've seen numerous "This is really not supposed to happen!", "WTF?" or "Impossible to get here" comments in code. The fact is, if it is somewhere in you're code, it will most probably be reachable at runtime in some cases - if you have anticipated it or not.

And it seems like this even happens to the programmers at Google. I got this reply the other day when I refreshed my Google Reader view:



We are all just human!

["Sometimes it pays to stay in bed on Monday, rather than spending the rest of the week debugging Monday's code."
-Dan Salomon]

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?