job attempts and improved error handling