Class: ActionReporter::HoneybadgerReporter

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

Instance Method Summary collapse

Methods inherited from Base

class_accessor, #merge_context_updates, #resolve_check_in_id, #resolve_user_id, #transaction_id=, #transaction_name=, #transform_context

Instance Method Details

#check_in(identifier) ⇒ Object



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

def check_in(identifier)
  check_in_id = resolve_check_in_id(identifier)
  honeybadger_class.check_in(check_in_id)
end

#context(args) ⇒ Object



10
11
12
13
14
15
# File 'lib/action_reporter/honeybadger_reporter.rb', line 10

def context(args)
  current = honeybadger_class.get_context || {}
  merged = merge_context_updates(current, args)
  honeybadger_class.context.clear!
  honeybadger_class.context(merged) unless merged.empty?
end

#current_user=(user) ⇒ Object



26
27
28
29
# File 'lib/action_reporter/honeybadger_reporter.rb', line 26

def current_user=(user)
  id = resolve_user_id(user)
  honeybadger_class.context(user_id: id)
end

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



5
6
7
8
# File 'lib/action_reporter/honeybadger_reporter.rb', line 5

def notify(error, context: {})
  new_context = transform_context(context)
  honeybadger_class.notify(error, context: new_context)
end

#reset_contextObject



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

def reset_context
  honeybadger_class.context.clear!
end