is ON ERROR.. different in v9?

Hi All

Code that previously trapped the error condition in v8 isn't doing it's job in v9.

The offending code is:

PROCESS-BLOCK:
DO TRANSACTION ON ERROR UNDO, LEAVE:

/* point A */

FOR EACH <blah>:
DO <blah>.
/* point B */
END.

END.

If an error conditon is raised at "point A" then the PROCESS-BLOCK is undone correctly.

If an error conditon is raised during the FOR EACH at "point B" then the PROCESS-BLOCK is not undone and the next record of the FOR EACH is processed.

If I add 'ON ERROR UNDO PROCESS-BLOCK, LEAVE PROCESS-BLOCK' in the FOR EACH statement, it traps errors and works correctly.

I'm sure I didn't need to do this in v8 as the outermost ON ERROR would trap errors in the FOR EACH loop.

Can anyone enlighten me please?

Cheers
Chris
 
I was surprised to hear about that odd behavior therefore I've checked your pseudocode on 8th version it works in the same way as on 9th and 10th versions.

FOR EACH <blah>:
DO <blah>.
/* point B */
END.

btw what does 'DO' in the second line mean here?
 
I can't enlighten you much.

There are various FOR/LEAVE/ERROR bugs listed in the knowledgebase, including RECID in WHERE clause, WRITE triggers and UDFs in clause.

Default FOR EACH error logic is to undo current iteration and retry/next of current block. I doubt very much that an intentional change in FOR EACH/ON ERROR processing logic would have been introduced, but I don't have V8 to test.

Perhaps if you were to demonstrate an example against Sports, someone with V8 could test.

FWIW I think that specifying a Label is much better, as it removes ambiguity for anyone amending the code at a later date.


yeeeehah! 500!
 
Not so long ago, we were pretty close with # of posts....

Hard to keep up with you :lol:

Cheers mate!

Casper.
 
Back
Top