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 Method Summary collapse

Instance Method Details

#clear_contextObject



20
21
22
# File 'lib/exceptions/backends/honeybadger.rb', line 20

def clear_context
  ::Honeybadger.clear!
end

#context(ctx) ⇒ Object



16
17
18
# File 'lib/exceptions/backends/honeybadger.rb', line 16

def context(ctx)
  ::Honeybadger.context ctx
end

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



8
9
10
11
12
13
14
# File 'lib/exceptions/backends/honeybadger.rb', line 8

def notify(exception, options = {})
  if id = ::Honeybadger.notify_or_ignore(exception, options)
    Result.new id
  else
    BadResult.new
  end
end

#rack_exception(exception, env) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/exceptions/backends/honeybadger.rb', line 24

def rack_exception(exception, env)
  notify(exception, rack_env: env) unless ::Honeybadger.
    configuration.
    ignore_user_agent.
    flatten.
    any? { |ua| ua === env['HTTP_USER_AGENT'] }
end