Go to the first, previous, next, last section, table of contents.


Error Processing

If an error occurs, Logo takes the following steps. First, if there is an available variable named ERRACT, Logo takes its value as an instructionlist and runs the instructions. The operation ERROR may be used within the instructions (once) to examine the error condition. If the instructionlist invokes PAUSE, the error message is printed before the pause happens. Certain errors are "recoverable"; for one of those errors, if the instructionlist 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 instructionlist.)

It is possible for an ERRACT instructionlist to produce an inappropriate value or no value where one is needed. As a result, the same error condition could recur forever because of this mechanism. To avoid that danger, if the same error condition occurs twice in a row from an ERRACT instructionlist without user interaction, the message "Erract loop" is printed and control returns to toplevel. "Without user interaction" means that if ERRACT invokes PAUSE and the user provides an incorrect value, this loop prevention mechanism does not take effect and the user gets to try again.

During the running of the ERRACT instructionlist, ERRACT is locally unbound, so an error in the ERRACT instructions themselves will not cause a loop. In particular, an error during a pause will not cause a pause-within-a-pause unless the user reassigns the value [PAUSE] to ERRACT during the pause. But such an error will not return to toplevel; it will remain within the original pause loop.

If there is no available ERRACT value, Logo handles the error by generating an internal THROW "ERROR. (A user program can also generate an error condition deliberately by invoking THROW.) 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 in a user program locally unbinds ERRACT, so the effect is that whichever of ERRACT and CATCH "ERROR is more local will take precedence.

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.

See section erract ; section throw ; section error ; section catch ; section pause ; section continue

Error Codes

Here are the numeric codes that appear as the first member of the list output by ERROR when an error is caught, with the corresponding messages. Some messages may have two different codes depending on whether or not the error is recoverable (that is, a substitute value can be provided through the ERRACT mechanism) in the specific context. Some messages are warnings rather than errors; these will not be caught. Errors 0 and 32 are so bad that Logo exits immediately.


  0	Fatal internal error (can't be caught)
  1	Out of memory
  2	PROC doesn't like DATUM as input (not recoverable)
  3	PROC didn't output to PROC
  4	Not enough inputs to PROC
  5	PROC doesn't like DATUM as input (recoverable)
  6	Too much inside ()'s
  7	You don't say what to do with DATUM
  8	')' not found
  9	VAR has no value
 10	Unexpected ')'
 11	I don't know how to PROC (recoverable)
 12	Can't find catch tag for THROWTAG
 13	PROC is already defined
 14	Stopped
 15	Already dribbling
 16	File system error
 17	Assuming you mean IFELSE, not IF (warning only)
 18	VAR shadowed by local in procedure call (warning only)
 19	Throw "Error
 20	PROC is a primitive
 21	Can't use TO inside a procedure
 22	I don't know how to PROC (not recoverable)
 23	IFTRUE/IFFALSE without TEST
 24	Unexpected ']'
 25	Unexpected '}'
 26	Couldn't initialize graphics
 27	Macro returned VALUE instead of a list
 28	You don't say what to do with VALUE
 29	Can only use STOP or OUTPUT inside a procedure
 30	APPLY doesn't like BADTHING as input
 31	END inside multi-line instruction
 32	Really out of memory (can't be caught)


Go to the first, previous, next, last section, table of contents.