You need to place the catch on the call to nlapiXM...
# suitescript
m
You need to place the catch on the call to nlapiXMLToPDF(xml);