How do I read error messages in ruby and ruby on rails? -


if big error message in ruby or ruby on rails , don't understand it, how can decipher error message before posting stack overflow. there tools tips or techniques me bottom of error messages, , find code having problem?

error messages in ruby , ruby on rails quite clear if @ them closely. "stack trace" helpful. shows 3 things need solve problem:

  1. the paths of files involved
  2. the line numbers of files
  3. the name of block error occurred in. example:

    c:\users\krishnac\documents\netbeansprojects\githupbdcm\trunk>bundle exec rake  rake aborted! incompatible library version - c:/ruby200/lib/ruby/gems/2.0.0/gems/bcrypt-ruby-3.1.1.rc1-x86-mingw32/lib/bcrypt_ext.so c:/users/krishnac/documents/netbeansprojects/githupbdcm/trunk/config/application.rb:13:in <top (required)>' c:/users/krishnac/documents/netbeansprojects/githupbdcm/trunk/rakefile:5:in require' c:/users/krishnac/documents/netbeansprojects/githupbdcm/trunk/rakefile:5:in `<top (required)>' `(see full trace running task --trace)` 

so have message

  1. we can tell reading error can traced file

    c:/users/krishnac/documents/netbeansprojects/githupbdcm/trunk/rakefile:5 

    this doen't mean error occured in file, 1 of methods got called leading error is in file.

  2. the :5 indicates fifth line error occurs.

  3. the next part of tells error occurs in block require:

    rakefile:5:in 'require' 

so see, reading error messages isn't bad. have through until find the file know relevant , find line number want , fix code.


Comments