Tools.h++ Manual
18-6 104011 Tandem Computers Incorporated
18
18.2 External errors
The distinguishing characteristic of external errors is that they are caused by
external conditions and, hence, cannot reasonably be predicted in advance. In
an object-oriented environment, runtime errors frequently show up as an
attempt to set an object into an invalid state, perhaps as a result of invalid user
input. An example is initializing a date object with a bad date (e.g., 31 June
1992, a date that doesn’t exist).
Distinguishing characteristics:
• Cannot reasonably predict them in advance.
• Usually occur at a more abstract level.
• Hence, cost of detection is relatively low.
• Detected in all versions of the library.
Examples:
• Attempt to set a bad date (E.g., “31 June 1992”).
• Attempt to invert a singular matrix.
• Stream write error.
• Out of memory.
Response:
• Throw an exception inheriting from RWInternalErr;
• Or provide a test for object validity.