easy-soft
2 years agoOccasional Contributor
Errorhandling in JScript KDTOperation
I have a custom KDTOperation written in JScript installed as script extension. The operation is called at the start of my keyword test. The aim of the operation is to terminate a running process of the tested application.
The simplified code looks as follows:
function KillProcess()
{
try
{
Sys.Process('my application.exe').Terminate();
}
catch (e)
{
Log.Warning(e.message);
}
}
This works fine if the process is running but the test fails when the process is not running: the catch-block is never called even though an exception is thrown in the try part. What am I doing wrong? How can I handle an exception in my own KDTOperations?