Bad error handling and exception management can rapidly undermine user confidence in your software product or application, and even in your company. The average end user is becoming increasingly sophisticated in her expectations of your software. She knows that properly coded software doesn't crash and burn, lose her work, or leave her stranded facing an error message bleating feebly about "Action aborted due to file specification error." She wants a stable and polite application that doesn't blame her for every nervous breakdown suffered by the software. Most of all, she wants error handling that supplies her with the right type of information to help her complete whatever task she's trying to accomplish.
This puts a big responsibility upon us as developers to understand why and where our applications can go wrong, and to create an error-handling framework that helps our end users to accomplish their tasks and helps the support staff and maintenance developers to diagnose and find problems as quickly and easily as possible. Good exception management is important because error-handling code is a frequent cause of bugs and because bad error handling can kill your application.
The first section of this chapter suggests some ideas about what you should be trying to achieve with an error-handling scheme. The second section looks in detail at exceptions, exception management, and error handling in VB .NET, with some surprises along the way. The final section investigates unhandled exceptions and some other advanced exception management techniques.