ProvideX V8.20 > Language Reference > 2. Directives
314
SETERR Directive
         Set Error Transfer
Formats
1. Error Transfer to Line/Label: SETERR stmtref
2. Error Transfer to Program: SETERR prog$[;entry$]
Where:
;entry$
Optional entry label in the error-trapping program. Define once per session.
prog$
Name of a generic error-trapping program. Define it once per session.
stmtref
Program line number or label to transfer control to.
Description
Use SETERR to define the transfer address for any error for which you have not used the
ERR= option. While a SETERR is in effect, any error (divide check, subscript range error,
etc.) transfers control to the statement number, label, or program specified in SETERR. To
disable the SETERR transfer in a program, use statement number 0000 as stmtref.
Once a SETERR transfer occurs, ProvideX inhibits further SETERR transfers until either
another SETERR is executed or a RETRY directive re-executes the statement which caused
the error. This prevents system looping caused by errors in an error handler.
The chart below shows the order of precedence for error handling:
ERR=
Error trapping at the line level
SETERR stmtref
General error trapping within a program
SETERR "prog;entry"
General error trapping for the current session. Entry point is optional.
Drop to the console and report the error (provided the 'XT'
... else ...
parameter is disabled).
ERROR_HANDLER READ can be used to determine the current ERROR_HANDLER or
SETERR program in effect.
See Also
ERROR_HANDLER Define Generic Handler, p.120
Error Processing in the ProvideX User's Guide
Example
3160 SETERR 3230
3170 DATA 1,2,3,"CAT"
3180 DATA 4,5,6,"DOG"
3190 READ DATA IOL=3220
3200 PRINT IOL=3220
3210 GOTO 3190
3220 IOLIST X,Y,Z,A$
3230 PRINT "GOTCHA"
3240 SETERR 0000 ! Disables SETERR
3250 STOP
-:GOTO 3160; BEGIN; RUN
1 2 3CAT
4 5 6DOG
GOTCHA