Central Exception Handlers

It’s tedious to add exception handling to all procedures in a project, but it’s a necessity. Every unexpected exception must be displayed to the user in the same format, and this can take a considerable amount of code. Adding a central exception handler can help tremendously.

A central exception handler is a procedure that you call when an exception occurs. At a minimum, a central exception handler displays a consistent error message to the user. However, you can add capabilities to the central exception handler as you see fit. For instance, you can have your central exception handler send an e-mail message to a support specialist whenever an unexpected exception occurs, or you can actually include code to take a snapshot ...

Get Practical Standards for Microsoft® Visual Basic® .NET, Second Edition 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.