Class: Hutch::ErrorHandlers::Bugsnag

Inherits:
Base
  • Object
show all
Defined in:
lib/hutch/error_handlers/bugsnag.rb

Instance Method Summary collapse

Methods included from Logging

#logger, logger, logger=, setup_logger

Instance Method Details

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



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/hutch/error_handlers/bugsnag.rb', line 8

def handle(properties, payload, consumer, ex)
  message_id = properties.message_id
  prefix = "message(#{message_id || "-"}):"
  logger.error "#{prefix} Logging event to Bugsnag"
  logger.error "#{prefix} #{ex.class} - #{ex.message}"

  ::Bugsnag.notify(ex) do |report|
    report.add_tab(:hutch, {
      payload: payload,
      consumer: consumer
    })
  end
end

#handle_setup_exception(ex) ⇒ Object



22
23
24
25
26
27
# File 'lib/hutch/error_handlers/bugsnag.rb', line 22

def handle_setup_exception(ex)
  logger.error "Logging setup exception to Bugsnag"
  logger.error "#{ex.class} - #{ex.message}"

  ::Bugsnag.notify(ex)
end