Class: ActionReporter::SentryReporter

Inherits:
Base
  • Object
show all
Defined in:
lib/action_reporter/sentry_reporter.rb

Instance Method Summary collapse

Methods inherited from Base

class_accessor, #resolve_check_in_id, #transform_context

Instance Method Details

#context(args) ⇒ Object



17
18
19
# File 'lib/action_reporter/sentry_reporter.rb', line 17

def context(args)
  sentry_class.get_current_scope.set_context("context", transform_context(args))
end

#current_user=(user) ⇒ Object



25
26
27
# File 'lib/action_reporter/sentry_reporter.rb', line 25

def current_user=(user)
  sentry_class.set_user(user_global_id: user&.to_global_id&.to_s)
end

#notify(error, context: {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/action_reporter/sentry_reporter.rb', line 5

def notify(error, context: {})
  sentry_class.with_scope do |temp_scope|
    temp_scope.set_context("context", transform_context(context))

    if error.is_a?(StandardError)
      sentry_class.capture_exception(error)
    else
      sentry_class.capture_message(error)
    end
  end
end

#reset_contextObject



21
22
23
# File 'lib/action_reporter/sentry_reporter.rb', line 21

def reset_context
  sentry_class.get_current_scope.set_context("context", {})
end