Debugging Your Application

Exceptions

On the Newton system functions throw exceptions, rather than returning error codes. When an exception occurs, the currently executing function aborts, as does the function that calls it, and so on up the line. Eventually, the Newton puts up a slip displaying the error number (see FIGURE 8.12).

FIGURE 8.12 : Example of Newton displaying error code in response to an exception.



Note:This book does not attempt to cover programming with exceptions in NewtonScript. Instead, it deals with debugging in the face of exceptions.


If the Inspector is connected when an exception occurs, a message describing the exception is printed to the Inspector window (see FIGURE 8.13). In some cases--for exceptions that are caught but not displayed--no such message will appear.

FIGURE 8.13 : Inspector information about an exception.


Breaking on an Exception
The Thorns of Break Loops
Breaking Using BreakLoop()
Exiting a Break Loop
Showing a Stack Trace
Named Variables and Parameters
Getting the Value of self
Getting Functions
Disassembly
Breakpoints
Stepping
The Interpreter Stack

An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.

Last modified: 1 DEC 1996