Forum Discussion

robertovip's avatar
robertovip
New Contributor
14 years ago

Exception handling across several Delphiscript units still not working.

This thread originated in the old forums.



I am now using TestComplete 7.52.678.5 and exception handling across several Delphiscript units is still a problem.



When will this be fixed? Reducing the call stack is not an option.



AutomatedQA Support <support@automatedqa.com> wrote:

>Hi Roberto,

>

>Unfortunately, fixing the problem requires massive changes in the

>DelphiScript engine, and we cannot do this for TestComplete 6. However,

>we are planning to modify the engine significantly in one of future

>versions of TestComplete 7 (most probably, the problem will be fixed in

>that version too).

>

>As for TestComplete 6, please note that the following script works

>correctly in v. 6.53:

>

>Unit1:

>

>uses

>   Unit2;

>procedure Main;

>begin

>   try

>     Unit2.RaiseException();

>   except

>     Log.Error('Handled exception', ExceptionMessage)

>   end;

>end;

>

>Unit2:

>

>procedure RaiseException;

>begin

>   Log.Message('a message ...');

>   raise('exception in the Unit2 unit');

>end;

>

>So, the problem you reported occurs only if the exception is passed

>among three units, and you can reduce the call-stack depth to avoid it.

>

>--

>Best regards,

>Allen - AQA Support

>

>Roberto wrote:

>> Apparently there has to be a unit with no trapping between the unit that traps

>> and the unit that raises for this not to work right.

>>

>> By the way, code looks like this:

>>

>> Proc A in Unit A in try/except block calls Proc B in Unit B

>> Proc B in Unit B calls Proc C in Unit C (if you change B to trap and reraise

>> it will work corerctly.)

>> Proc C in Unit C raises exception (exception not trapped by Proc A)

>>

>> UnitA:

>> uses UnitB;

>>

>> procedure ProcA;

>> begin

>>   try

>>     ProcB;

>>   except

>>     Log.Error('Error trapped in ProcA. [' + exceptionmessage + ']');

>>   end;

>> end;

>>

>> UnitB:

>> uses UnitC;

>>

>> procedure ProcB;

>> begin

>>   ProcC;

>> end;

>>

>> UnitC:

>> procedure ProcC;

>> begin

>>   raise('Error raised in ProcC');

>> end;

>>

>>

>> "Roberto" <robertovip@no-spam.hotmail.com> wrote:

>>> Apparently there is a known issue in Delphiscript with exceptions not being

>>> caught if the try...except block is in one unit while the exception is thrown

>>> in a different unit. I would like to know when this is going to be fixed

>>> in TC6. My project makes heavy use of exceptions and I rather not implement

>>> a workaround.

>>

1 Reply


  • Hi Roberto,





    We are likely to find a way to solve the problem, but this will require quite a few changes in TestComplete. We are going to implement the changes in TestComplete 8, which will be released in a month or so.