Class: Hutch::ErrorHandlers::Sentry

Inherits:
Base
  • Object
show all
Defined in:
lib/hutch/error_handlers/sentry.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
# File 'lib/hutch/error_handlers/sentry.rb', line 8

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}"
  ::Sentry.configure_scope do |scope|
    scope.set_context("payload", JSON.parse(payload))
  end
  ::Sentry.capture_exception(ex)
end

#handle_setup_exception(ex) ⇒ Object



19
20
21
22
23
# File 'lib/hutch/error_handlers/sentry.rb', line 19

def handle_setup_exception(ex)
  logger.error "Logging setup exception to Sentry"
  logger.error "#{ex.class} - #{ex.message}"
  ::Sentry.capture_exception(ex)
end