Help with "Record Not Found"

Help with "Record Not Found"

"Record Not Found" is not necessarily an error message, but a situation I want to prevent from disabling my Deluge script, and allowing it to finish with some alternative output. In it, The code is in a CRM custom function, and I'm searching for a record in the "Products" module of the CRM.

productSearchCriteria="(Product Name|=|" + ws1 + ")";
productSearchResults = zoho.crm.searchRecords("Products",productSearchCriteria);

This 2 line approach is necessary because "ws1" is a variable.

The problem I've observed is that if the value of ws1 is not found in the Products module, the script seems to end.
I've tried putting in a test for the size of the maplist(?) "found" in the search...

if(productSearchResults.size()  !=  0)

but that does not seem to work.

I'm wondering if I should be approaching this differently by using searchRecordsByPDC instead. Will that provide a means to catch a failed search and allow the script to finish?