Class: Exceptions::Backends::Honeybadger

Inherits:
Exceptions::Backend show all
Defined in:
lib/exceptions/backends/honeybadger.rb

Overview

Public: The Honeybadger backend is a Backend implementation that sends the exception to Honeybadger.

Defined Under Namespace

Classes: Result

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(honeybadger = ::Honeybadger) ⇒ Honeybadger

Returns a new instance of Honeybadger.



10
11
12
# File 'lib/exceptions/backends/honeybadger.rb', line 10

def initialize(honeybadger = ::Honeybadger)
  @honeybadger = honeybadger
end

Instance Attribute Details

#honeybadgerObject (readonly)

Returns the value of attribute honeybadger.



8
9
10
# File 'lib/exceptions/backends/honeybadger.rb', line 8

def honeybadger
  @honeybadger
end

Instance Method Details

#clear_contextObject



28
29
30
# File 'lib/exceptions/backends/honeybadger.rb', line 28

def clear_context
  honeybadger.clear!
end

#context(ctx) ⇒ Object



24
25
26
# File 'lib/exceptions/backends/honeybadger.rb', line 24

def context(ctx)
  honeybadger.context ctx
end

#notify(exception, options = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/exceptions/backends/honeybadger.rb', line 14

def notify(exception, options = {})
  return if options[:rack_env] && rack_ignore?(options[:rack_env])
  defaults = { backtrace: caller.drop(1) }
  if id = honeybadger.notify_or_ignore(exception, defaults.merge(options))
    Result.new id
  else
    BadResult.new
  end
end