StackTrace
Jump to navigation
Jump to search
In Mini Micro and Farmtronics, the stackTrace
method returns a list of program locations that represent the call stack.
Example
In this hypothetical example, a program two import modules, gui
and events
, encounters a error in the gui
module that causes the program to break out to the command line. Entering pprint stackTrace
at this point produces the following.
]pprint stackTrace [ gui.ms line 276, (current program) line 152, events.ms line 165, events.ms line 203, (current program) line 323 ]
This stackTrace
result is interpreted as follows:
- The first line in the result is where the error occurred: line 276 of the file gui.ms.
- The next line shows where that final call into gui.ms was made, i.e., line 152 of the currently loaded program.
- That was called from events.ms line 165...
- which in turn was called from line 203 of the same module.
- Finally, that initial call into events was made from line 323 of the current program.
In this way, you can see not only where the error occurred, but how the code got there.
See also: Debugging Tips