Error with the PUTS and invalid variables

R

Ramza Brown

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.newspiritcompany.com
http://www.newspiritcompany.com/newforums
also checkout alpha version of botverse:
http://www.newspiritcompany.com:8086/universe_home
 
T

ts

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%
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top