Using the C++ Math Library | ![]() ![]() |
Exception Class Descriptions
Each exception class is described briefly below.
mwException
The base class for the exception classes, mwException
, has two direct descendants: mwLogicError
and mwRuntimeError
. Most catch
-blocks catch mwException
objects rather than instances of one of its subclasses.
mwLogicError
A subclass of mwException
. Logic errors occur as the result of bugs, either in your code or in the library itself. Generally, they are fatal, which means no corrective action can be taken by the program. The code itself needs to be modified.
mwSubclassResponsibility
A subclass of mwLogicError
. Exceptions of this type are thrown when a subclass does not completely reimplement the virtual interface of its parent class. Under normal circumstances, you should never see an exception of this type. Refer to a C++ reference guide for a more thorough treatment of virtual interfaces and inheritance.
mwRuntimeError
A subclass of mwException
. Most commonly encountered errors fall into this category. Run-time errors are often nonfatal and indicate nothing more serious than invalid input or resource conflicts. Some, however, can be fatal.
mwChainError
A subclass of mwRuntimeError
. An mwChainError
is used to wrap up and rethrow exceptions that were caught but not completely handled by a catch
-block.
mwRangeError
A subclass of mwRuntimeError
. An unrepresentable or unexpected value has resulted from a computation. This error may point to a problem in either the input or the code for the computation.
mwDomainError
A subclass of mwRuntimeError
. A function has encountered unexpected or corrupt input. Of all the error classes listed here, domain errors are the easiest from which to recover.
mwOverflowError
A subclass of mwRuntimeError
. Some form of arithmetic overflow has occurred.
mwIllegalOperation
A subclass of mwRuntimeError
. The programmer has attempted to perform an operation that is not supported. Often, this error occurs when an operation is not yet implemented. The only recourse for errors of this type is to avoid the offending operation.
mwBadAlloc
A subclass of mwRuntimeError
. The operating system has denied the program's request for more dynamic memory, generally resulting in a "A memory allocation request failed"
message.
![]() | Exception Classes | Error Messages | ![]() |