class Hutch::ErrorHandlers::SentryRaven

Public Class Methods

new() click to toggle source
# 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

Public Instance Methods

handle(properties, payload, consumer, ex) click to toggle source
# File lib/hutch/error_handlers/sentry_raven.rb, line 15
def handle(properties, payload, consumer, ex)
  message_id = properties.message_id
  prefix = "message(#{message_id || '-'}):"
  logger.error "#{prefix} Logging event to Sentry"
  logger.error "#{prefix} #{ex.class} - #{ex.message}"
  Raven.capture_exception(ex, extra: { payload: payload })
end
handle_setup_exception(ex) click to toggle source
# 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.message}"
  Raven.capture_exception(ex)
end