Module: Honeybadger

Defined in:
lib/honeybadger-local-context.rb

Class Method Summary collapse

Class Method Details

.notify_with_context(exception, options = {}) ⇒ Object Also known as: notify



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/honeybadger-local-context.rb', line 6

def notify_with_context(exception, options = {})

  ctx = binding.of_caller(1)
  vars = eval('local_variables', ctx)
  locals_array = vars.map { |arg| [arg, eval(arg.to_s, ctx)]}

  options[:context] ||= {}
  options[:context][:local_variables] = Hash[*locals_array.flatten(1)]

  puts "Notify called with options: #{options}"

  return notify_without_context(exception, options)
end