Kbase P50688: 4GL: all changes inside a transaction are not undone when error occurs inside another procedure
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/10/2008 |
|
Status: Unverified
FACT(s) (Environment):
Progress 9.x
SYMPTOM(s):
All changes in the transaction are not undone when error occurs inside another procedure
A procedure does not return an error to a calling procedure
CAUSE:
By default, a procedure handles an error like a 'DO ON ERROR UNDO,
RETRY:', not 'DO ON ERROR UNDO, RETURN ERROR:'.
In the following example, only change2 and change3 will be undone. Change1 is committed even though it is inside the same transaction.
do transaction on error undo:
run a.
run b.
end.
procedure a:
- change1
end.
procedure b:
- change2
- change3 --> causes an error
end.
When the error occurs, Progress undoes the subtransaction in procedure b (change2 and change3) and tries to execute procedure for a second time. If Progress detects that repeating the block would cause an indefinite loop, it will do 'ON ERROR LEAVE'.
As progress doesn't propagate error to a calling procedure, execution
successfully goes to the end of the transaction and "change1" will be committed.
FIX:
Implement a block with "DO ON ERROR UNDO, RETURN ERROR" inside each procedure. In the following example also the "change1" is be undone.
do transaction on error undo:
run a.
run b.
end.
procedure a:
do on error undo, return error:
- change1
end.
end.
procedure b:
do on error undo, return error:
- change2
- change3 --> causes an error
end.
end.