Essential Tools Module Exception Architecture
The
RWxmsg class serves as a base class for the various exception types that can be thrown and caught within the Essential Tools Module library, or from within Essential Tools Module client applications.
The Essential Tools Module uses the following hierarchy.
As shown in
Figure 9,
RWxmsg serves as a base class for all exception types. From this point, the three major types of exceptions are derived: external errors, internal errors, and stream buffer allocation errors. Let us describe each of these classes in greater detail.
RWxmsg
RWxmsg provides a basic interface for exceptions, from which an exception string is always available. This exception string is obtained through the
why method, and is represented as a
const char*, single-byte character sequence.
RWExternalErr
RWExternalErr is derived from
RWxmsg, and is used to report errors caused by external sources over which the library has no control. Currently, this class is used to report errors from
RWFileManager and
RWCollectable during file processing when an invalid file format is encountered.
RWStreamErr
RWStreamErr is an external error reported when invalid stream data is encountered. For example, this class is used to report errors from
RWeistream when an invalid stream header is encountered.
RWFileErr
RWFileErr is a type of external error reported when file
IO operations fail. For example,
RWBTreeOnDisk makes extensive use of this class to report file
read,
seek, and
write errors.
RWxalloc
RWxalloc is a type of
RWxmsg that can be used to report buffer allocation errors.
RWInternalErr
RWInternalErr is a type of error that is used to report errors that occur within the Essential Tools Module. For example,
RWDateTime uses this class to report operations on invalid date/time objects.
RWRegexErr
RWRegexErr is used to report regular expression compilation errors from
RWTRegex<T>.
RWBoundsErr
RWBoundsErr is used to report invalid indexes into buffers. For example
RWCString may report this type of error when an invalid index is provided to the
assertElement method.