Problems to catch manualy raised AppError

TomBlue999

New Member
I cannot catch an Progress.Lang.AppError in the calling program if there is no preceeding Progress.Lang.SysError. Here's the simplified example:

TestClass2.cls:
Code:
routine-level on error undo, throw.
class TestClass2:

 method public void ProduceManualError ():

  do on error undo, leave:
   if true then undo, throw new Progress.Lang.AppError("Raised Manual Error", 1).
  end.
 end method.

 method public void ProduceSysError ():

  do on error undo, leave:
   find _field where _field._file-recid = 24452442421441.
   catch e as Progress.Lang.SysError:
    undo, throw new Progress.Lang.AppError("Caught System Error", 2).
   end catch.
  end.
 end method.
end class.

When calling the ProduceSysError() method within the TestClass2.cls I can catch the error in the calling program, but when calling ProduceManualError() method then Progress simply displays the error in the message line, but is not catching the error.

Example Procedure TestCaller2:
Code:
/* Test_Caller2.p */routine-level on error undo, throw.
def var TC2 as TestClass2 no-undo. 
do on error undo, leave:

 TC2 = new TestClass2().
 TC2:ProduceManualError().
 TC2:ProduceSysError().
 
 catch ex as Progress.Lang.AppError:
  message ex:GetMessage(1) ex:GetMessageNum(1) view-as alert-box.
  undo, leave.
 end catch.
end.
In this example, IMHO, Progress should only display the Error produced by the "TC2:produceManualError()." call and then leave the block. Instead, it displays the Error message from first method call (uncatched) and catches only the second error.

(By the way, if you change the order of the both calls, everything is as expected: First call raises error, is caught and then the second call is not done anymore.)

Is this incorrect progress behaviour (bug?) or do I have misunderstood anything concerning structured error handling. Same happens if you're using an own ErrorClass inherited from Progress.Lang.AppError of course.

By the way, using 10.2A in character mode.

Any ideas?
THX
Thomas
 

Stefan

Well-Known Member
Not sure about what the handling should be, but if you change

Code:
do on error undo, leave:

to

Code:
do on error undo, throw

Then the error is thrown.
 

TomBlue999

New Member
Hi Stefan!

Thanks a lot. Shame on me, I thought I had tried this also, but it seems that I missed this. Code works as expected now!

Cheers
Thomas
 
Top