Class: Appsignal::Integrations::RailsErrorReporterSubscriber Private

Inherits:
Object
  • Object
show all
Defined in:
lib/appsignal/integrations/railtie.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.

Report errors reported by the Rails error reporter.

We only report that are not reraised by the error reporter, using Rails.error.handle.

Class Method Summary collapse

Class Method Details

.report(error, 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.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/appsignal/integrations/railtie.rb', line 57

def report(error, handled:, severity:, context: {}, source: nil)
  # Ignore not handled errors. They are reraised by the error reporter
  # and are caught and recorded by our Rails middleware.
  return unless handled

  Appsignal.send_error(error) do |transaction|
    namespace, action_name, path, method, params, tags, custom_data =
      context_for(context.dup)
    transaction.set_namespace(namespace) if namespace
    transaction.set_action(action_name) if action_name
    transaction.("path", path)
    transaction.("method", method)
    transaction.params = params
    transaction.set_sample_data("custom_data", custom_data) if custom_data

    tags[:severity] = severity
    tags[:source] = source.to_s if source
    transaction.set_tags(tags)
  end
end