
13
Programming Environment
2.4
Debugging
The handheld reader contains a built-in error log that can be used when debugging scripts.
To debug the script when an error has occurred, send the ‘(‘ command to the reader; the
reader responds by sending the error log to the communications port. The error log may
contain messages from the firmware that should be ignored. JavaScript errors in the log
can be identified by the format: filename:lineNumber. If there are many error codes in the
error log, send the ‘)’ command to clear the log and repeat the steps to create the error,
leaving only one entry in the log.
Example:
X ap/gerror-log. storage_init: flMountVolume fail status 26,
formatting.storage_formatFilesystem: status 0.
temp.js:3: TypeError: gui.aler is not a function. X ap/dEOF.
This error log contains one firmware error and one JavaScript error. The JavaScript error
description begins with temp.js:3: and tells us that on line three of the temp.js file, gui.aler
is not recognized as a function. In this case, gui.alert has been misspelled (it is missing the
t).