Sha256: c054d86bbad7164ea9976da32a86e68f3c92b5ba63b897f34a8b29748e25c9aa

Contents?: true

Size: 993 Bytes

Versions: 11

Compression:

Stored size: 993 Bytes

Contents

module Sentry
  module Rails
    # This is not a user-facing class. You should use it with Rails 7.0's error reporter feature and its interfaces.
    # See https://github.com/rails/rails/blob/main/activesupport/lib/active_support/error_reporter.rb to learn more about reporting APIs.
    # If you want Sentry to subscribe to the error reporter, please set `config.rails.register_error_subscriber` to `true`.
    class ErrorSubscriber
      SKIP_SOURCES = Regexp.union([/.*_cache_store.active_support/])

      def report(error, handled:, severity:, context:, source: nil)
        tags = { handled: handled }

        if source
          return if SKIP_SOURCES.match?(source)
          tags[:source] = source
        end

        if context[:tags].is_a?(Hash)
          context = context.dup
          tags.merge!(context.delete(:tags))
        end

        Sentry::Rails.capture_exception(error, level: severity, contexts: { "rails.error" => context }, tags: tags)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sentry-rails-5.16.1 lib/sentry/rails/error_subscriber.rb
sentry-rails-5.15.2 lib/sentry/rails/error_subscriber.rb
sentry-rails-5.15.1 lib/sentry/rails/error_subscriber.rb
sentry-rails-5.15.0 lib/sentry/rails/error_subscriber.rb
sentry-rails-5.14.0 lib/sentry/rails/error_subscriber.rb
sentry-rails-5.13.0 lib/sentry/rails/error_subscriber.rb
sentry-rails-5.12.0 lib/sentry/rails/error_subscriber.rb
sentry-rails-5.11.0 lib/sentry/rails/error_subscriber.rb
sentry-rails-5.10.0 lib/sentry/rails/error_subscriber.rb
sentry-rails-5.9.0 lib/sentry/rails/error_subscriber.rb
sentry-rails-5.8.0 lib/sentry/rails/error_subscriber.rb