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

#after_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.



14
15
16
# File 'lib/honeybadger/plugins/resque.rb', line 14

def after_perform_with_honeybadger(*args)
  Honeybadger.clear!
end

#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
# File 'lib/honeybadger/plugins/resque.rb', line 10

def around_perform_with_honeybadger(*args)
  Honeybadger.flush { yield }
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.



20
21
22
23
24
# 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) ⇒ 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)


26
27
28
29
30
31
32
33
# 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