Fix exception mailing when a job fails repeatedly

There was a bug in the queue workers that was preventing failures being reported, and another that was causing errors in development (when no exception mailer is set up).