diff --git a/exe/schked b/exe/schked index 3756d26..54c298f 100755 --- a/exe/schked +++ b/exe/schked @@ -1,4 +1,4 @@ -#!/usr/bun/ruby +#!/usr/bin/ruby # frozen_string_literal: true require "bundler/setup" diff --git a/lib/schked/version.rb b/lib/schked/version.rb index 451e571..330abbb 100644 --- a/lib/schked/version.rb +++ b/lib/schked/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Schked - VERSION = "1.1.0" + VERSION = "1.1.1" end diff --git a/lib/schked/worker.rb b/lib/schked/worker.rb index c44fc19..5d846a0 100644 --- a/lib/schked/worker.rb +++ b/lib/schked/worker.rb @@ -47,7 +47,12 @@ def define_callbacks cfg = config scheduler.define_singleton_method(:on_error) do |job, error| - cfg.logger.fatal("Task #{job.opts[:as] || job.job_id} failed with error: #{error.message}") + name = if job + job.opts[:as] || job.job_id + else + "unknown" + end + cfg.logger.fatal("Task #{name} failed with error: #{error.message}") cfg.logger.error(error.backtrace.join("\n")) if error.backtrace cfg.fire_callback(:on_error, job, error)