Wrap Agenda job error logging inside if