Interpreting Exceptions

The IException class is the base exception class. When you want to signal that your code has encountered some unusual situation, you should throw whichever subclass of IException best conveys the nature of the situation. You can convey the nature of most unusual situations using one of the exceptions described in this section.

The following table lists the exception classes that are derived from IException and the situations in which they are typically thrown:

Exception Class Thrown When ...
IAccessError A logical error occurs, such as "resource not found."
IAssertionFailure The expression in an IASSERT macro evaluates to false.
IDeviceError A hardware-related error occurs.
IInvalidParameter An invalid parameter is passed; the expression in an IASSERTPARM macro evaluates to false.
IInvalidRequest An object is in the wrong state for a function; the expression in an IASSERTSTATE macro evaluates to false.
IResourceExhausted A resource is exhausted or currently unavailable.
IOutOfMemory Memory is exhausted.
IOutOfSystemResource System resource is exhausted.
IOutOfWindowResource Window resource is exhausted.
IAlreadyExists Requested object could not be created because an object with the same name or location already exists.
ICannotProceed An operation could not be completed, but it may be possible to continue the operation or recover in some other fashion.
IInvalidName Used an invalid name for an object (e.g. a file or network resource).
IMustBeEmpty An operation on a container failed because the container was not empty.
IObjectNotFound An operation failed because it was unable to locate the requested object.

The following classes are used in conjunction with the IException class and its derived classes:

IException::TraceFn
A support class for the IException class.
 
IExceptionLocation
A support class for the IException class. The IEXCEPTION_LOCATION macro expands to create an instance of the IExceptionLocation class.


Using Throw Macros
Using Assertion Macros
Using try and catch
Rethrowing Exceptions
Deriving Your Own Exceptions
Tracing Exceptions


The Exceptions Mechanism
Using Exceptions