Class: Raven::Rails::BacktraceCleaner

Inherits:
ActiveSupport::BacktraceCleaner
  • Object
show all
Defined in:
lib/raven/integrations/rails/backtrace_cleaner.rb

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initializeBacktraceCleaner

Returns a new instance of BacktraceCleaner.


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/raven/integrations/rails/backtrace_cleaner.rb', line 10

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