May 28, 2003
Writing good exceptions

Cameron Laird on how to use exceptions - Writing good exceptions. Not how to use them in terms of syntax, but rather in terms of semantics. The examples are in Python, but the advice is applicable to any language supporting exceptions.

We have a lot of classes in one of my current Java projects (written by a cow orker) in which every method has a catch-all exception handler which logs any unexpected error, and then tries to keep on going. Me, I prefer the RuntimeException approach.

Posted to Software development by Simon Brunning at 01:45 PM