javascript try/catch block
I thought try/catch blocks were supposed to help you avoid failures/exceptions. That is how they work in C# and from my understanding, this is how thye work in Javascript. Why is the below code still throwing an error? If it doesn't find the process called 'someProcess' the try/catch block should catch the error ... no error should exist in the test result. However, from the following code, I get a test failure stating that "The process 'someProcess' was not found".
function testing()
{
try
{
var ml = Sys.Process("someProcess");
//ml.Close();
}
catch(e)
{}
}
See Process Method - "The Process method returns a Process object by its application name and index. If the process is not found, the method returns an empty object and posts the message “The process … was not found” to the test log". Majority of the methods in TC are like this i.e. returns object or null.
An empty object doesn't throw an exception.