Progress
Language Reference
ON ERROR Phrase
Describes the processing that occurs when there is an error in a block. If you are using a REPEAT block or a FOR EACH block, and an error occurs, all of the processing that has been done in the current iteration of the block is undone, and Progress retries the block iteration where the error occurred. (If Progress detects that a RETRY of a FOR or iterating DO block would produce an infinite loop, it performs a NEXT instead. For more information, see the Progress Programming Handbook .)
SYNTAX
label1
The name of the block whose processing you want to undo. If you do not name a block with label1, ON ERROR UNDO undoes the processing of the block started by the statement that contains the ON ERROR phrase.
LEAVE [ label2 ]
Indicates that after undoing the processing of a block, Progress leaves the block labeled label2. If you do not name a block, Progress leaves the block labeled with label1.
NEXT [ label2 ]
Indicates that after undoing the processing of a block, Progress executes the next iteration of the block you name with the label2 option. If you do not name a block with the NEXT option, Progress executes the next iteration of the block labeled with label1.
RETRY [ label1 ]
Indicates that after undoing the processing of a block, Progress repeats the same iteration of the block you name with the label1 option.
RETRY is the default processing if you do not use LEAVE, NEXT, RETRY, or RETURN.
RETURN [ ERROR | NO-APPLY ]
Returns to the calling procedure, or if there is no calling procedure, to the Progress Editor. Specifying ERROR causes the ERROR condition in the calling procedure. This causes the current subtransaction to be undone. You cannot specify ERROR within a user-interface trigger block. You can specify the NO-APPLY option only within a user-interface trigger block to prevent Progress from performing the default behavior for that event. For example, the default behavior for an character code key press in a fill-in field is to echo the character in the field.
return-string
If you specify return-string, the string you provide is passed to the calling procedure. That procedure can use the RETURN-VALUE function to read the returned value.
EXAMPLEIn
r-onerr.p,
if you enter a customer number and the FIND statement is unable to find a customer with that number, Progress returns an error. If an error occurs, the ON ERROR phrase tells Progress to undo anything that was done in the current iteration and start the next iteration. Thus, you see any invalid numbers you enter, and you can continue to the next customer number you want to enter.
SEE ALSO
ON ENDKEY Phrase, ON QUIT Phrase, ON STOP Phrase, RETURN Statement, RETURN-VALUE Function
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |