Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Full stracktrace in ruby 1.9

Reply
Thread Tools

Full stracktrace in ruby 1.9

 
 
Freak Guard
Guest
Posts: n/a
 
      09-25-2009
I'm getting stacktraces like:

expected Foo, got #<NoMethodError: undefined method `bar=' for
nil:NilClass>
spec/models/foobar_spec.rb:79:in `block (6 levels) in <top (required)>'

but it would be way more useful to get the 6 levels. How to enable that
globally?
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Roger Pack
Guest
Posts: n/a
 
      09-25-2009
Freak Guard wrote:
> I'm getting stacktraces like:
>
> expected Foo, got #<NoMethodError: undefined method `bar=' for
> nil:NilClass>
> spec/models/foobar_spec.rb:79:in `block (6 levels) in <top (required)>'
>
> but it would be way more useful to get the 6 levels. How to enable that
> globally?


add this somewhere:


at_exit {
puts "==== "
puts $!.backtrace.join("\n")
puts "===="
}

Though there are other options [1]

http://github.com/rogerdpack/ruby_ba...g_swallowed.rb
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Robert Klemme
Guest
Posts: n/a
 
      09-25-2009
On 25.09.2009 16:40, Roger Pack wrote:
> Freak Guard wrote:
>> I'm getting stacktraces like:
>>
>> expected Foo, got #<NoMethodError: undefined method `bar=' for
>> nil:NilClass>
>> spec/models/foobar_spec.rb:79:in `block (6 levels) in <top (required)>'
>>
>> but it would be way more useful to get the 6 levels. How to enable that
>> globally?

>
> add this somewhere:
>
>
> at_exit {
> puts "==== "
> puts $!.backtrace.join("\n")
> puts "===="
> }
>
> Though there are other options [1]
>
> http://github.com/rogerdpack/ruby_ba...g_swallowed.rb


You could simply wrap the whole script or the offending region in begin
rescue.

robert


--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
First ever full day Ruby and Ruby On Rails event in India sur Ruby 1 11-04-2008 04:53 PM
[ANN] Debian ruby-full package - a full installation of Ruby vince.hetk@gmail.com Ruby 1 05-28-2007 05:08 PM
#!/usr/bin/ruby , #!/usr/bin/ruby -w , #!/usr/bin/ruby -T?, #!/usr/bin/ruby -T1... anne001 Ruby 1 04-23-2006 03:02 PM
Re: XP Pro (Full) , X64 (Full) and Windows Server 2003 R2 TRIAL - which is latest ntldr ? - Bobb - Windows 64bit 9 12-14-2005 04:59 PM
Options for generic full-text search without using database-specific full-text engine? Samuel R. Neff ASP .Net 2 06-10-2005 06:53 PM



Advertisments