Module: Honeybadger::Plugins::Resque::Extension Private

Defined in:
lib/honeybadger/plugins/resque.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#around_perform_with_honeybadger(*args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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


10
11
12
13
14
# File 'lib/honeybadger/plugins/resque.rb', line 10

def around_perform_with_honeybadger(*args)
  Honeybadger.flush { yield }
ensure
  Honeybadger.context.clear!
end

#on_failure_with_honeybadger(e, *args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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


18
19
20
# File 'lib/honeybadger/plugins/resque.rb', line 18

def on_failure_with_honeybadger(e, *args)
  Honeybadger.notify(e, parameters: { job_arguments: args }, sync: true) if send_exception_to_honeybadger?(e, args)
end

#send_exception_to_honeybadger?(e, args) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

22
23
24
25
26
27
28
29
# File 'lib/honeybadger/plugins/resque.rb', line 22

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