Rules of Programming: Handle Exceptions First
When you write a new function, always make sure to handle exceptions first. Then write the actual function. It's as easy as that.
One of the most common failures: a variable containing something else than expected (either null value or wrong input). Make sure you handle it.
Also: use logging to catch errors. log4net and Elmah will help.
Rule #13 of programming:
Handle exceptions first