Chapter 14. Error Processing

Error Codes

If an error occurs, Logo takes the following steps. First, if there is an available variable named ERRACT, Logo takes its value as an instruction list and runs the instructions. The operation ERROR may be used within the instructions (once) to examine the error condition. If the instruction list invokes PAUSE, the error message is printed before the pause happens. Certain errors are "recoverable"; for one of those errors, if the instruction list outputs a value, that value is used in place of the expression that caused the error. (If ERRACT invokes PAUSE and the user then invokes CONTINUE with an input, that input becomes the output from PAUSE and therefore the output from the ERRACT instruction list.)

It is possible for an ERRACT instruction list to produce an inappropriate value or no value where one is needed. As a result, the same error condition could recur forever.

During the running of the ERRACT instruction list, the value of ERRACT is ignored, so that an error in the ERRACT instruction list does not cause a loop. In particular, an error during a pause does not cause a pause-within-a-pause.

If ERRACT has no value, Logo handles the error by generating an internal THROW "ERROR. If this THROW is not caught by a CATCH "ERROR in the user program, it is eventually caught either by the toplevel instruction loop or by a pause loop, which prints the error message. An invocation of CATCH "ERROR takes precedence over ERRACT.

If a floating point overflow occurs during an arithmetic operation, or a two-input mathematical function (like POWER) is invoked with an illegal combination of inputs, the "doesn't like" message refers to the second operand, but should be taken as meaning the combination. Logo