Appendix O. Useful Exception Classes
When your program throws an exception, it's easy enough to use a Try Catch
block to catch the exception and examine it to determine its class. When you want to throw your own exception, however, you must know what exception classes are available so that you can pick the right one.
For more information on error handling, see Chapter 19, "Error Handling," and Appendix F.
Standard Exception Classes
The following table lists some of the most useful exception classes in Visual Basic .NET. You can raise one of these when you need to throw an error.
Class | Purpose |
---|---|
| The program could not figure out which overloaded object method to use. |
| This is the ancestor class for all nonfatal application errors. When you build custom exception classes, you should inherit from this class, or from one of its descendants. |
| An argument is invalid. |
| An argument that cannot be |
| An argument is out of its allowed range. |
| An arithmetic, casting, or conversion operation has occurred. |
| The program tried to store the wrong type of item in an array. |
| A configuration setting is invalid. |
| A data operation violates a database constraint. |
| The ancestor class for ADO.NET exception classes. |
| A needed directory is missing. |
| The program ... |
Get Visual Basic® 2008 Programmer's Reference 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.