Use this statement in a procedure (.p) or class (.cls) file to change the default ON ERROR directive to UNDO, THROW for all blocks that have a default error directive associated with them. (A simple DO block, for example, does not have default error handling and is not affected by this statement.). The default ON ERROR directive is either UNDO, LEAVE or UNDO, RETRY, depending on the block type.
BLOCK-LEVEL ON ERROR UNDO, THROW.
Instead of adding the statement to source-code files, you can use the -undothrow 2 startup parameter to change the default error-handling to UNDO, THROW on every block affected by the BLOCK-LEVEL statement during compilation. See the OpenEdge Deployment: Startup Command and Parameter Reference for more information.
The ROUTINE-LEVEL ON ERROR UNDO, THROW statement can be used if you want to change the default error-handling only on routine-level blocks. (You can use the -undothrow 1 startup parameter to change the default error-handling on routine-level blocks to UNDO, THROW during compilation.)An error propagates from the DO TRANSACTION block to the internal procedure, from the internal procedure up to the main .p file (b-BLOCK-LEVEL-01.p), and finally up to the CATCH block in the calling .p file (b-BLOCK-LEVEL-02.p). An error is raised at each of these levels. At each level the ON ERROR UNDO, THROW directive takes effect.
RUN b-BLOCK-LEVEL-01.p (INPUT cValue, INPUT dDate).CATCH err AS Progress.Lang.Error:MESSAGE "Customer or order not found " err:GetMessage(1)VIEW-AS ALERT-BOX INFO BUTTONS OK.END.
The BLOCK-LEVEL statement affects the same blocks as the ROUTINE-LEVEL ON ERROR UNDO, THROW statement, plus REPEAT, FOR, and DO TRANSACTION blocks. Therefore, there is no need to add both statements to a file. If both statements exist in a file, the more inclusive BLOCK-LEVEL statement takes precedence.
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |