Chapter 10. Exception Handling

The grandest of intentions and the most thorough planning can’t eliminate errors in code. Errors can be programmer errors (usually caused by bad assumptions, such as that a denominator will never be 0) or environmental errors (such as an attempt to save a file that is too large for the amount of free space on a disk). You should strive for error-free code, but you should also create every procedure with the assumption that an error might occur. This means that every procedure must contain an error handler.

There are practically an infinite number of possible program errors, but they basically fall into two types: compile (build) errors and run-time errors (called exceptions). A build error is an error that prevents ...

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.