Sha256: 31f6e9b2876a30430525f44cc3dc82c1c50fe2d92d56e2cd688a62f90cb3adf5

Contents?: true

Size: 835 Bytes

Versions: 3

Compression:

Stored size: 835 Bytes

Contents

require "active_support/backtrace_cleaner"
require "active_support/core_ext/string/access"

module Raven
  class Rails
    class BacktraceCleaner < ActiveSupport::BacktraceCleaner
      APP_DIRS_PATTERN = /\A(?:\.\/)?(?:app|config|lib|test|\(\w*\))/.freeze
      RENDER_TEMPLATE_PATTERN = /:in `.*_\w+_{2,3}\d+_\d+'/.freeze

      def initialize
        super
        # we don't want any default silencers because they're too aggressive
        remove_silencers!

        @root = "#{Raven.configuration.project_root}/"
        add_filter do |line|
          line.start_with?(@root) ? line.from(@root.size) : line
        end
        add_filter do |line|
          if line =~ RENDER_TEMPLATE_PATTERN
            line.sub(RENDER_TEMPLATE_PATTERN, "")
          else
            line
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sentry-raven-3.1.2 lib/raven/integrations/rails/backtrace_cleaner.rb
sentry-raven-3.1.1 lib/raven/integrations/rails/backtrace_cleaner.rb
sentry-raven-3.1.0 lib/raven/integrations/rails/backtrace_cleaner.rb