Fixed error handling in jobs.js