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

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

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.

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.



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/honeybadger/plugins/rails.rb', line 33

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:

  • (Boolean)


46
47
48
49
50
# File 'lib/honeybadger/plugins/rails.rb', line 46

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