class Exceptions::Backends::Honeybadger
Public: The Honeybadger
backend is a Backend
implementation that sends the exception to Honeybadger
.
Attributes
honeybadger[R]
Public Class Methods
new(honeybadger = ::Honeybadger)
click to toggle source
# File lib/exceptions/backends/honeybadger.rb, line 10 def initialize(honeybadger = ::Honeybadger) @honeybadger = honeybadger end
Public Instance Methods
clear_context()
click to toggle source
# File lib/exceptions/backends/honeybadger.rb, line 28 def clear_context honeybadger.clear! end
context(ctx)
click to toggle source
# File lib/exceptions/backends/honeybadger.rb, line 24 def context(ctx) honeybadger.context ctx end
notify(exception, options = {})
click to toggle source
# 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
Private Instance Methods
rack_ignore?(env)
click to toggle source
# File lib/exceptions/backends/honeybadger.rb, line 40 def rack_ignore?(env) return honeybadger. configuration. ignore_user_agent. flatten. any? { |ua| ua === env['HTTP_USER_AGENT'] } end