class Raygun::ErrorSubscriber

Subscribes to errors using Rails’ error reporting API edgeguides.rubyonrails.org/error_reporting.html

Public Instance Methods

report(error, handled:, severity:, context:, source: nil) click to toggle source
# File lib/raygun/error_subscriber.rb, line 4
def report(error, handled:, severity:, context:, source: nil)
  tags = context.delete(:tags) if context.is_a?(Hash)

  data = {
    custom_data: {
      "rails.error": {
        handled: handled,
        severity: severity,
        context: context,
        source: source
      },
    },
    tags: ["rails_error_reporter", *tags].compact
  }

  if source == "job.sidekiq" && defined?(Sidekiq)
    Raygun::SidekiqReporter.call(error, data)
  else
    Raygun.track_exception(error, data)
  end
end