[stackoverflow] [progress Openedge Abl] Catching Errors From Procedures Outside Of...

Status
Not open for further replies.
T

Tony

Guest
I have following code (it's simplified for illustration purposes). I'm creating records in different DB tables in proc1, proc2, and proc3. What I'm trying to achieve is...if I encounter an error while looping through temp-tables at any point (even after I created a bunch of DB records already), I want to roll everything back so no records are created. It catches errors if proc1, proc2, and proc3 with no issues but I cannot figure out how to pass those errors to the main processing block so it understands it and rolls everything back. In other words, the message ('error @ main trans block') never pops up so the already created records stay in the DB. As a matter of fact, nothing gets rolled back.

DO TRANSACTION ON ERROR UNDO, THROW:

FOR EACH tt1:

RUN proc1.

FOR EACH tt2 WHERE tt2.field1 EQ tt1.field1:

RUN proc2.

FOR EACH tt3 WHERE tt3.field2 EQ tt2.field2:

RUN proc3.

END.

END.

END.

CATCH e AS PROGRESS.Lang.AppERROR:

MESSAGE 'error @ main trans block'
VIEW-AS ALERT-BOX INFO BUTTONS OK.

END CATCH.

END.

PROCEDURE proc1.
DO TRANSACTION ON ERROR UNDO, THROW:

/* creating some DB records */

CATCH e AS PROGRESS.Lang.ERROR:

RETURN ERROR 'Proc1 ' + e:getmessage(1).

END CATCH.

END.

END PROCEDURE.

PROCEDURE proc2.
DO TRANSACTION ON ERROR UNDO, THROW:

/* creating some DB records */

CATCH e AS PROGRESS.Lang.ERROR:

RETURN ERROR 'Proc2 ' + e:getmessage(1).

END CATCH.

END.

END PROCEDURE.

PROCEDURE proc3.
DO TRANSACTION ON ERROR UNDO, THROW:

/* creating some DB records */

CATCH e AS PROGRESS.Lang.ERROR:

RETURN ERROR 'Proc3 ' + e:getmessage(1).

END CATCH.

END.

END PROCEDURE.


TIA

Continue reading...
 
Status
Not open for further replies.
Top