I am using CronJob. What should I do if I get an error when executing myFunction
var CronJob = require('cron').CronJob;
var job = new CronJob('00 30 11 * * 1-5', function myFunction() {
//Do something
}, function () {
/* This function is executed when the job stops */
},
true, /* Start the job right now */
timeZone /* Time zone of this job. */
);
Just put if/else statement for error. That way your app won't crash. You can add a logger to your app and log all errors that occur in cron job.