Unwanted lines in rails console error reporting

139 views Asked by At
?> error
NameError: undefined local variable or method `error' for main:Object
    from (irb):7
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/railties-4.2.0.beta4/lib/rails/commands/console.rb:110:in `start'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/railties-4.2.0.beta4/lib/rails/commands/console.rb:9:in `start'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/railties-4.2.0.beta4/lib/rails/commands/commands_tasks.rb:68:in `console'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/railties-4.2.0.beta4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/railties-4.2.0.beta4/lib/rails/commands.rb:17:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:252:in `require'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:252:in `block in require'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:237:in `load_dependency'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:252:in `require'
    from /home/ubuntu/workspace/sample_app/bin/rails:8:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:246:in `load'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:246:in `block in load'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:237:in `load_dependency'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:246:in `load'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/spring-1.1.3/lib/spring/commands/rails.rb:6:in `call'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/spring-1.1.3/lib/spring/command_wrapper.rb:38:in `call'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/spring-1.1.3/lib/spring/application.rb:180:in `block in serve'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/spring-1.1.3/lib/spring/application.rb:153:in `fork'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/spring-1.1.3/lib/spring/application.rb:153:in `serve'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/spring-1.1.3/lib/spring/application.rb:128:in `block in run'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/spring-1.1.3/lib/spring/application.rb:122:in `loop'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/spring-1.1.3/lib/spring/application.rb:122:in `run'
    from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/spring-1.1.3/lib/spring/application/boot.rb:18:in `<top (required)>'
    from /usr/local/rvm/rubies/ruby-2.1.4/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/rvm/rubies/ruby-2.1.4/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1:in `<main>'

In rails console when I commit an error, the console displays tons of lines which I don't want to see. Can this be silenced?

I've found that you can add this line:

Rails.backtrace_cleaner.add_silencer { |line| line =~ /rvm/ }

in config/initializers/backtrace_silencers.rb but this doesn't resolve the problem.

0

There are 0 answers