Error Objects
The
InexactErr and
OverflowErr error objects contain information about the cause of the error. You can access this information through four methods common to both decimal and fixed decimal versions of the error classes. For example, for the
RWDecimal<T> versions of these error objects, the public member functions are:
RWDecimal<T> leftOperand() const
RWDecimal<T> rightOperand() const
RWDecimalBase::Op operation() const
RWCString msg() const
The enumerated type
RWDecimalBase::Op has one of these values:
assign,
add,
sub,
mult,
div,
powop,
pow10op,
strctor,
conversion. If an overflow handler does not exit, an
NaN value results. The message is a short string describing the origin of the error.
All the error objects are derived from either
RWInternalErr or
RWExternalErr. These classes are designed as base classes for objects that are thrown as exceptions. Thus, throwing error objects as exceptions is a reasonable thing to do.