Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: Backtrace without skips needed
Nathaniel Talbott
11/26/2003 12:04:00 PM
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...
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
<:((><
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: Backtrace without skips needed
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password