Marty Andrews

artful code

Friday, February 9, 2007

Exception handling rules of thumb

  1. Put your try/catch block around the smallest set of code that you can.
  2. Catch the most specific exception that you can.
  3. Interestingly, most applications should have one place in the system that completely violates both of these rules. It's the last line of defence to protect your users from whatever horrible things try to escape from inside your code.

No comments:

Post a Comment