Class: Hutch::ErrorHandlers::SentryRaven
- Defined in:
- lib/hutch/error_handlers/sentry_raven.rb
Instance Method Summary collapse
- #handle(properties, payload, consumer, ex) ⇒ Object
- #handle_setup_exception(ex) ⇒ Object
-
#initialize ⇒ SentryRaven
constructor
A new instance of SentryRaven.
Methods included from Logging
#logger, logger, logger=, setup_logger
Constructor Details
#initialize ⇒ SentryRaven
Returns a new instance of SentryRaven.
9 10 11 12 13 |
# File 'lib/hutch/error_handlers/sentry_raven.rb', line 9 def initialize unless Raven.respond_to?(:capture_exception) raise "The Hutch Sentry error handler requires Raven >= 0.4.0" end end |
Instance Method Details
#handle(properties, payload, consumer, ex) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/hutch/error_handlers/sentry_raven.rb', line 15 def handle(properties, payload, consumer, ex) = properties. prefix = "message(#{ || '-'}):" logger.error "#{prefix} Logging event to Sentry" logger.error "#{prefix} #{ex.class} - #{ex.}" Raven.capture_exception(ex, extra: { payload: payload }) end |
#handle_setup_exception(ex) ⇒ Object
23 24 25 26 27 |
# File 'lib/hutch/error_handlers/sentry_raven.rb', line 23 def handle_setup_exception(ex) logger.error "Logging setup exception to Sentry" logger.error "#{ex.class} - #{ex.}" Raven.capture_exception(ex) end |