Class: Hutch::ErrorHandlers::Honeybadger
- Defined in:
- lib/hutch/error_handlers/honeybadger.rb
Overview
Error handler for the Honeybadger.io service
Instance Method Summary collapse
- #handle(properties, payload, consumer, ex) ⇒ Object
- #handle_setup_exception(ex) ⇒ Object
-
#notify_honeybadger(message) ⇒ Object
Wrap API to support 3.0.0+.
Methods included from Logging
#logger, logger, logger=, setup_logger
Instance Method Details
#handle(properties, payload, consumer, ex) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/hutch/error_handlers/honeybadger.rb', line 10 def handle(properties, payload, consumer, ex) = properties. prefix = "message(#{ || '-'}):" logger.error "#{prefix} Logging event to Honeybadger" logger.error "#{prefix} #{ex.class} - #{ex.}" notify_honeybadger(error_class: ex.class.name, error_message: "#{ex.class.name}: #{ex.}", backtrace: ex.backtrace, context: { message_id: , consumer: consumer }, parameters: { payload: payload }) end |
#handle_setup_exception(ex) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/hutch/error_handlers/honeybadger.rb', line 23 def handle_setup_exception(ex) logger.error "Logging setup exception to Honeybadger" logger.error "#{ex.class} - #{ex.}" notify_honeybadger(error_class: ex.class.name, error_message: "#{ex.class.name}: #{ex.}", backtrace: ex.backtrace) end |
#notify_honeybadger(message) ⇒ Object
Wrap API to support 3.0.0+
34 35 36 37 38 39 40 |
# File 'lib/hutch/error_handlers/honeybadger.rb', line 34 def notify_honeybadger() if ::Honeybadger.respond_to?(:notify_or_ignore) ::Honeybadger.notify_or_ignore() else ::Honeybadger.notify() end end |