Class: Raygun::ErrorSubscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/raygun/error_subscriber.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#report(error, handled:, severity:, context:, source: nil) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 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