Class: Hutch::ErrorHandlers::Honeybadger

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/hutch/error_handlers/honeybadger.rb

Instance Method Summary collapse

Methods included from Logging

#logger, logger, logger=, setup_logger

Instance Method Details

#handle(message_id, payload, consumer, ex) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/hutch/error_handlers/honeybadger.rb', line 9

def handle(message_id, payload, consumer, ex)
  prefix = "message(#{message_id || '-'}): "
  logger.error prefix + "Logging event to Honeybadger"
  logger.error prefix + "#{ex.class} - #{ex.message}"
  ::Honeybadger.notify_or_ignore(
    :error_class => ex.class.name,
    :error_message => "#{ ex.class.name }: #{ ex.message }",
    :backtrace => ex.backtrace,
    :context => {
      :message_id => message_id,
      :consumer => consumer
    },
    :parameters => {
      :payload => payload
    }
  )
end