
The Debugging Process
When an exception occurs and you have breakOnThrows set, the Inspector will display a description of the error, and possibly some additional information. Here's an example:
Exception |evt.ex.fr.type;type.ref.frame|: [-48404] Expected a number. Got: {value: NIL}
In this error, you can see that a number was expected. Most likely, the error occurred during an arithmetic operation (the most obvious operations requiring numbers). The other piece of information is that instead of a number it got a nil value. Thus, the code that was executing used a nil value instead of a number. At this point you might consider trying to track down which variables are set to nil (perhaps with the prudent use of printing variable values). In a similar vein, the Inspector might display:
Exception |evt.ex.fr.type;type.ref.frame|: [-48404]
Expected a number. Got: {value: "hello"}
Here, the same error has occurred, but the value is now "hello" rather than the desired integer.Here's a final example:
Exception |evt.ex.fr.intrp;type.ref.frame|: [-48809]
Undefined method "Foo" {Symbol: Foo}
In this case, the code tried to call a method, Foo, which didn't exist.
An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.
Last modified: 1 DEC 1996