module Honeybadger::Plugins::Resque::Extension

Public Instance Methods

after_perform_with_honeybadger(*args) click to toggle source
# File lib/honeybadger/plugins/resque.rb, line 14
def after_perform_with_honeybadger(*args)
  Honeybadger.clear!
end
around_perform_with_honeybadger(*args) { || ... } click to toggle source

Executed before on_failure hook; the flush is necessary so that errors reported within jobs get sent before the worker dies.

# File lib/honeybadger/plugins/resque.rb, line 10
def around_perform_with_honeybadger(*args)
  Honeybadger.flush { yield }
end
on_failure_with_honeybadger(e, *args) click to toggle source

Error notifications must be synchronous as the on_failure hook is executed after around_perform.

# File lib/honeybadger/plugins/resque.rb, line 20
def on_failure_with_honeybadger(e, *args)
  Honeybadger.notify(e, parameters: { job_arguments: args }, sync: true) if send_exception_to_honeybadger?(e, args)
ensure
  Honeybadger.clear!
end
send_exception_to_honeybadger?(e, args) click to toggle source
# File lib/honeybadger/plugins/resque.rb, line 26
def send_exception_to_honeybadger?(e, args)
  return true unless respond_to?(:retry_criteria_valid?)
  return true if ::Honeybadger.config[:'resque.resque_retry.send_exceptions_when_retrying']

  !retry_criteria_valid?(e)
rescue => e
  Honeybadger.notify(e, parameters: { job_arguments: args }, sync: true)
end