{Begin Chapter Errors and Break Handling}
{Title Errors and Break Handling}
{Text


{Note Chapter Status:
Reorganized, revised

Changes needed:
(1) Examples (transcipts?)
(2) More information needed for inexperianced user who wants to know what to do about an error (perhaps should be in "how to use Interlisp" chapter).
(3) List of error messages should be moved out into an appendix, eventually}

Occasionally, while a program is running, an error may occur which will stop the computation.  A coding mistake may have caused the wrong arguments to be passed to a function, or the programmer may have not forseen a particular unusual situation which came up, causing a function to try doing something illegal.  Interlisp provides extensive facilities for detecting and handling error conditions, to enable testing, debugging,and revising of imperfect programs.

Errors can be caused in different ways.  As mentioned above, an Interlisp primitive function may signal an error if given illegal arguments; for example, {fn PLUS} will cause an error if its arguments are not numbers.  It is also possible to interrupt a computation at any time by typing one of the "interrupt characters," such as control-D or control-E (the Interlisp-D interrupt characters are listed on {PageRef Tag InterruptCharsD}; those for Interlisp-10 on {PageRef Tag InterruptChars10}).  Finally, as an aid to debugging, the programmer can specify that certain functions should cause an error automatically whenever they are entered (see {PageRef Tag BreakingFunctions}).  This allows examination of the context within the computation.

When an error occurs, the system can either{foot
The mechanism used for deciding whether to unwind the stack or to go into a break is described on {PageRef Tag WhenToBreak}.  The user can modify this mechanism.
}{comment endfootnote}
reset and unwind the stack, or go into a "break", an environment where the user can examine the state of the system at the point of the error, and attempt to debug the program.  Within a break, Interlisp offers an extensive set of "break commands", which assist with debugging.


This chapter explains what happens when errors occur.  Breaks and break commands are given which allow the user to handle program errors.  Finally, advanced facilities for modifying and extending the error mechanism are presented.


{Include Breaks}

{Include ErrorFns}

{Include Resetvars}

{Include ErrorList}


}{End Chapter Errors and Break Handling}