Parece que não há tratamento de erros neste tipo de scripts. Você provavelmente deve adotar a solução proposta por esse cara :
So you have to have 2 scripts, one that runs and does stuff and handles situation when some value is not received as expected, and other script does the job, that can fail. as a result, if second script fails, first one that called second script to do the job will continue.