stebi
13 years agoOccasional Contributor
"try ... except" and Runner.CallMethod
Hi,
I have trouble with Runner.CallMethod. I'm not able to handle exceptions occuring inside the method call. See this code snippet:
procedure Foo;
begin
raise('Foo-Exception');
end;
procedure Execute;
begin
try
Evaluate('Foo'); // Exception inside Foo is successfully caught
except
Log.Error( ExceptionMessage);
end;
try
Runner.CallMethod('Foo');
except
Log.Error( ExceptionMessage); // Exception inside Foo is not caught. It turns in a "Script Runtime Error" an breaks the execution.
end;
end;
I cannot simple use Evaluate because it's not able to call methods from units which aren't included, but Runner can. It's no option for me to include those units because it's a framework which executes my tests defined elsewhere.
Is it a bug or by intention?
I have trouble with Runner.CallMethod. I'm not able to handle exceptions occuring inside the method call. See this code snippet:
procedure Foo;
begin
raise('Foo-Exception');
end;
procedure Execute;
begin
try
Evaluate('Foo'); // Exception inside Foo is successfully caught
except
Log.Error( ExceptionMessage);
end;
try
Runner.CallMethod('Foo');
except
Log.Error( ExceptionMessage); // Exception inside Foo is not caught. It turns in a "Script Runtime Error" an breaks the execution.
end;
end;
I cannot simple use Evaluate because it's not able to call methods from units which aren't included, but Runner can. It's no option for me to include those units because it's a framework which executes my tests defined elsewhere.
Is it a bug or by intention?