[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Error with the PUTS and invalid variables

Berlin Brown

4/18/2006 2:21:00 AM

Ignore the code itself.
puts "ERR: Could not parse document #{truncate(url)}"

But, I have noticed that whenever I have errors for example with
variables inside a string like above.

#{truncate(url)}

Here, I don't have a truncate method, so basically Ruby just stops. I
don't get an error and just guessed that is where the problem was?

That ruby hangs and doesnt produce an error. For example; I am also
working with threads so I can continue it is just hard to debug.

In anycase; why wouldnt an error be produced. Is there anything else
there that might just make Ruby stop?

def connect_http(url, id)
begin
puts "#{' '*8} #{id} process #{url}"
fetch_http_document(url)
rescue
puts "ERR: Could not parse document #{truncate(url)}"
puts "ERR: " + $!
end
end


--
Berlin Brown
(ramaza3 on freenode)
http://www.newspiritc...
http://www.newspiritc.../newforums
also checkout alpha version of botverse:
http://www.newspiritc...:8086/universe_home
2 Answers

ts

4/18/2006 7:42:00 AM

0

>>>>> "R" == Ramza Brown <berlin.brown@gmail.com> writes:

R> That ruby hangs and doesnt produce an error. For example; I am also
R> working with threads so I can continue it is just hard to debug.

Use Thread#abort_on_exception with threads

moulon% ruby -e 'Thread.new { puts "#{truncate(1)}" }'
moulon%

moulon% ruby -e 'Thread.abort_on_exception = true; Thread.new { puts "#{truncate(1)}" }'
-e:1: undefined method `truncate' for main:Object (NoMethodError)
from -e:1
moulon%

--

Guy Decoux

Berlin Brown

4/18/2006 11:44:00 PM

0

Hmm, didnt know about this.