Class: Sbmt::Outbox::ErrorTracker

Inherits:
Object
  • Object
show all
Defined in:
lib/sbmt/outbox/error_tracker.rb

Class Method Summary collapse

Class Method Details

.error(message, params = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/sbmt/outbox/error_tracker.rb', line 7

def error(message, params = {})
  unless defined?(Sentry)
    Outbox.logger.log_error(message, params)
    return
  end

  Sentry.with_scope do |scope|
    scope.set_contexts(contexts: params)

    if message.is_a?(Exception)
      Sentry.capture_exception(message, level: :error)
    else
      Sentry.capture_message(message, level: :error)
    end
  end
end