Here is a great example of code that you should never write:
Or, here is the only somewhat less evil managed equivalent:
I know why programmers do it:
These are all really nice sounding reasons. However, there are a couple of problems with this logic:
Okay, so hopefully by now I have convinced you that just ignoring all exceptions is the wrong thing to do. So, what should you be doing? You need to come up with a system for reporting unexpected exceptions. For client applications, this means notifying the user. For server applications, this means notifying the administrator. What should be included in this notification? Anything that _you_ will find useful. There should be details that are not for the user encountering the problem but rather the support person or developer that is called upon to solve it.
A few more suggestions:
In a future blog, I will create some sample code for reporting exceptions.
In conclusion, plan for imperfect code. Everyone has bugs. By reporting them instead of ignoring them, you make it easier to find and fix these problems at all stages in the product's life cycle.