1.3. Exception Handling Best Practices
Now that we've discussed how to handle and throw exceptions in theory, let's examine some principles and design patterns that will best help us do that in practice.
1.3.1. Defensive Programming
If you drive a car, you probably have automobile insurance. But even though you may be covered by insurance, an accident can be pretty expensive, financially and otherwise. You would probably agree that no matter how much insurance you may have in place, it's smart to be a "defensive driver" and avoid getting into an accident in the first place.
Exceptions are like accidents, and exception handling is like car insurance. While it's vitally important to have and though it may get you "back on the road," it's no substitute ...
Get Robust ASP.NET Exception Handling now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.