beautypg.com

Script error trapping functions, Script error trapping functions -71, Onerror – Xerox -05W User Manual

Page 275: Errorline, Errorcode

background image

12-71

Creating A Script File

Script Error Trapping Functions

The integrity of a script program can be checked by using the onerror, errorline and
errorcode commands. These enable you to quickly find any syntax errors within the
program. The following program lines provide an example of their use:

var %integer1, $string1
onerror gosub errorhandler:

(put your program here)

** Error Handler **
errorhandler:
errorline string1
errorcode integer1
wrt "Error: ", integer1, " - ", string1, "_r_n"
return

ONERROR

Syntax: ONERROR

This command will perform the specified action when it encounters an error while
the script program is running, where can be one of the following:

REPORT

will display a message box indicating the type of error and the
program line that caused it.

IGNORE

will ignore any errors encountered in the program.

GOTO

will cause the program to go to the line with the specified label
when an error is encountered.

GOSUB will cause the program to go to the line with the specified label

when an error is encountered and then return to the line fol-
lowing the error.

ERRORLINE

Syntax: ERRORLINE

This command will return the line number of the last error.

ERRORCODE

Syntax: ERRORCODE

This command specifies the type of error code that will be returned when an error is
encountered. Specifying an integer variable will return an error ID number, while a
string variable will return an error message. The following list shows the ID codes
and error messages that can be displayed, and their meanings.

This manual is related to the following products: