Table of Contents
This chapter describes GT.M features and techniques for handling errors. Errors in programs may be classified as "predictable" meaning foreseen, or "unpredictable" meaning unforeseen.
M programs may attempt to recover from predictable errors. Device errors that can be remedied by an operator are the most common class of errors for which recovery provides a large benefit. Predictable errors from which the program does not attempt to recover are generally treated the same as unpredictable errors.
A typical application handles unpredictable errors by logging as much information about the error as the designer considers useful, then terminating or restarting the application from a known point.
Because GT.M invokes error handling when things are not normal, careful design and implementation of error handling are required to minimize the impact of errors and the cost of subsequent prevention.
The GT.M compiler detects and reports syntax errors at:
Compile time while producing the object module from a source file.
Run time while compiling code for M indirection and XECUTEs.
Run time when the user is working in Direct Mode.
The GT.M run-time system:
Recognizes and reports execution errors when they occur.
Reports errors flagged by the compiler when they fall in the execution path.