Class: Honeybadger::Plugins::Rails::ErrorSubscriber Private

Inherits:
Object
  • Object
show all
Defined in:
lib/honeybadger/plugins/rails.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Class Method Summary collapse

Class Method Details

.report(exception, handled:, severity:, context: {}, source: nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/honeybadger/plugins/rails.rb', line 38

def self.report(exception, handled:, severity:, context: {}, source: nil)
  # We only report handled errors (`Rails.error.handle`)
  # Unhandled errors will be caught by our integrations (eg middleware),
  # which have richer context than the Rails error reporter
  return unless handled

  return if source_ignored?(source)

  tags = ["severity:#{severity}", "handled:#{handled}"]
  tags << "source:#{source}" if source
  Honeybadger.notify(exception, context: context, tags: tags)
end

.source_ignored?(source) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

API:

  • private



51
52
53
54
55
# File 'lib/honeybadger/plugins/rails.rb', line 51

def self.source_ignored?(source)
  source && ::Honeybadger.config[:"rails.subscriber_ignore_sources"].any? do |ignored_source|
    ignored_source.is_a?(Regexp) ? ignored_source.match?(source) : (ignored_source == source)
  end
end