User manual - Scripting_Guide

NAURTECH SMART CLIENTS FOR WINDOWS CE AND POCKET PC
CETerm Scripting Guide Page 64
Do not disable the “Script Timeout” unless you are sure your script will not enter
an infinite loop.
5.9 DEBUGGING SCRIPTS
All but the most trivial script will require some degree of debugging.
5.9.1 Show Script Errors
The first step is to enable “Show Script Errors”. This will enable a popup
message for compilation and runtime errors. Compilation errors will usually be
seen when new scripts are added or upon script engine startup. It may not be
clear which script loaded at startup contains the error. In this case you may need
to open the edit dialog for each script and tap the “Test/Load” button to identify
the bad script.
The compilation error looks like this:
Microsoft JScript compilation error
[Line: 15 Col: 8] Expected ‘)’
OS.Alert( message );
Notice that the line of script presented looks OK. In this case, the missing ‘)’ is
on the previous line of script, but the error is detected as the compiler reaches
column 8 of this line and encounters the ‘O’. Be sure to look around the
indicated location to identify the source of the error.
A runtime error may be seen at startup if a script is performing some initialization,
or it may be seen while using CETerm. It can be difficult to identify the source of
the error if the script was fired by an event or timer. Most often, a runtime error
can be prevented by “defensive coding” where you are sure to check the validity
of arguments and object references.
The runtime error looks like this:
Microsoft JScript runtime error
[Line: 14 Col: 9] Object doesn’t support this property
or method.
Unfortunately, the JScript engine does not return the source code line for a
runtime error. You must manually examine your scripts at the specified location
for a clue about the problem.