如何分析ruby错误?

时间:2012-01-14 09:38:34

标签: ruby-on-rails ruby exception logging error-handling

C:\ Users \ Vlad \ Desktop>佣金路线 (在C:/ Users / Vlad / Desktop中) 耙子流产了! 未初始化的常量Rake :: DSL

C:/Ruby192/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:8:in `<class:TaskLib>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:6:in `<module:Rake>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:3:in `<top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb:4:in `require'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb:4:in `<top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/test_unit/testing.rake:2:in `require'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/test_unit/testing.rake:2:in `<top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/test_unit/railtie.rb:12:in `load'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/test_unit/railtie.rb:12:in `block in <class:TestUnitRailtie>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `call'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `block in load_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `each'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `load_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:396:in `block in load_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in `each'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in `all'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:396:in `load_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:103:in `load_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
C:/Users/Vlad/Desktop/kindle/Rakefile:7:in `<top (required)>'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `load'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:1991:in `run'
C:/Ruby192/bin/rake:31:in `<main>'

你能告诉我为什么这些线出现在控制台中的逻辑吗?我对一个特定的错误不感兴趣。当一些东西搞砸了,我看到这样的日志,这是什么意思?

FIRST错误是否说明了程序崩溃的原因?如果错误真的很模糊,那么我应该在错误消息中寻找一般逻辑?

1 个答案:

答案 0 :(得分:1)

这些行只是异常的回溯 http://www.ruby-doc.org/core-1.9.3/Exception.html#method-i-backtrace

您也可以使用--trace flag

运行命令