Sha256: 19fc3953cd116e8e7ffdb5d37ecd5b4b556626478ee91c7d3a7e7c81f89f5ccf

Contents?: true

Size: 682 Bytes

Versions: 2

Compression:

Stored size: 682 Bytes

Contents

# Subscribes to errors using Rails' error reporting API
# https://edgeguides.rubyonrails.org/error_reporting.html
class Raygun::ErrorSubscriber
  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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
raygun4ruby-4.0.2 lib/raygun/error_subscriber.rb
raygun4ruby-4.0.1 lib/raygun/error_subscriber.rb