From: Nathaniel Talbott Date: 2003-11-26T21:04:26+09:00 Subject: Re: Backtrace without skips needed Tobias Peters [mailto:tpeters@invalid.uni-oldenburg.de] wrote: > Is there a way to tell ruby that it must never skip levels in the > backtrace like this: > > /lib/ruby/1.8/net/ftp.rb:192:in `readline': End of file > reached (EOFError) > from /lib/ruby/1.8/net/ftp.rb:192:in `getline' > from /lib/ruby/1.8/net/ftp.rb:202:in `getmultiline' > from /lib/ruby/1.8/net/ftp.rb:216:in `getresp' > from /lib/ruby/1.8/net/ftp.rb:232:in `voidresp' > from /lib/ruby/1.8/net/ftp.rb:157:in `connect' > from /lib/ruby/1.8/net/ftp.rb:155:in `synchronize' > from /lib/ruby/1.8/net/ftp.rb:158:in `connect' > from /lib/ruby/1.8/net/ftp.rb:119:in `initialize' > ... 7 levels... > from getp.rb:85:in `get_from' > from getp.rb:85:in `open' > from getp.rb:85:in `get_from' > from getp.rb:120 > > This is the backtrace the ruby interpreter prints out when it > terminates due to an unhandled exception. See http://www.ruby-talk.org/75008 and following. Basically it comes down to, you have to wrap your code in an exception handler if you want all the information, like so: require 'pp' begin ... all your code ... rescue Exception => e pp e.message pp e.class pp e.backtrace end I've used pp here, because it should give a much more readable printout of the backtrace with minimal work. HTH, Nathaniel <:((><