Tools.h++ Manual
104011 Tandem Computers Incorporated 18-5
18
Note – Note how the function always attempts to detect a bounds error. If it
finds one, then it throws an instance of
RWBoundsErr
, a class that inherits
from
RWInternalErr
. This instance contains an (internationalized) message
(discussed in “Localizing messages” on page 9” in Chapter 19,
“Implementation Notes”). The
RWTHROW
macro is discussed in “Error
handlers” on page 8.
Throwing an exception gives you the opportunity to catch the exception and,
possibly, recover. However, because the internal logic of the program has been
compromised, most likely you will want to attempt to save whatever
document is being worked on then abort the program.