The following table lists some useful exception classes.
Class | Purpose |
---|---|
AmbiguousMatchException | The program could not figure out which overloaded object method to use. |
ApplicationException | This is the ancestor class for all nonfatal application errors. When you build custom exception classes, you should inherit this class or one of its descendants. |
ArgumentException | An argument is invalid. |
ArgumentNullException | An argument that cannot be Nothing has value Nothing. |
ArgumentOutOfRangeException | An argument is out of its allowed range. |
ArithmeticException | An arithmetic, casting, or conversion operation has occurred. |
ArrayTypeMismatchException | The program tried to store the wrong type of item in an array. |
ConfigurationException | A configuration setting is invalid. |
ConstraintException | A data operation violates a database constraint. |
DataException | The ancestor class for ADO.NET exception classes. |
DirectoryNotFoundException | A needed directory is missing. |
DivideByZeroException | The program divided by zero. |
DuplicateNameException | An ADO.NET operation encountered a duplicate name (for example, it tried to create a second table with the same name). |
EvaluateException | Occurs when a DataColumn’s Expression property cannot be evaluated. |
FieldAccessException | The program tried to access a class property improperly. |
FormatException | An argument’s format doesn’t match its required format. For example, Integer.Parse(“Oops”). |
IndexOutofRangeException | The program tried to access an item outside of the bounds of an array or other container. |
InvalidCastException | The program tried to make an invalid conversion. For example, CInt(“oops”). |
InvalidOperationException | The operation is not currently allowed. |
IOException | The ancestor class for input/output (I/O) exception classes. A generic I/O error occurred. |
EndOfStreamException | A stream reached its end. |
FileLoadException | Error loading a file. |
FileNotFoundException | Error finding a file. |
InternalBufferOverflowException | An internal buffer overflowed. |
MemberAccessException | The program tried to access a class member improperly. |
MethodAccessException | The program tried to access a class method improperly. |
MissingFieldException | The program tried to access a class property that doesn’t exist. |
MissingMemberException | The program tried to access a class member that doesn’t exist. |
MissingMethodException | The program tried to access a class method that doesn’t exist. |
NotFiniteNumberException | A floating-point number is PositiveInfinity, NegativeInfinity, or NaN (not a number). You can get these values from the floating-point classes as in Single.Nan or Double.PositiveInfinity. |
NotImplementedException | The requested operation is not implemented. |
NotSupportedException | The requested operation is not implemented. For example, the program might be asking a routine to modify data that was opened read-only. |
NullReferenceException | The program tried to use an object reference that is Nothing. |
OutOfMemoryException | There isn’t enough memory. For example, if the user wants to generate a really huge data set, you may be able to predict how much memory the program will need, see if it is available, and throw this exception if it is not. |
OverflowException | An arithmetic, casting, or conversion operation created an overflow. For example, if X is a Byte variable containing the value 100, then the statement X = X * X throws this error. |
PolicyException | Policy prevents the code from running. |
RankException | A routine is trying to use an array with the wrong number of dimensions. |
ReadOnlyException | The program tried to modify read-only data. |
ResourceException | A needed resource is missing. |
SecurityException | A security violation occurred. |
SyntaxErrorException | A DataColumn’s Expression property contains invalid syntax. |
UnauthorizedAccessException | The system is denying access because of an I/O or security error. |