why does this prog still stop after exception


J

Junkone

i thought i put enough exception handlers for the prog to continue
after failure. why does it stop
require 'imDaveAlerts'
require "timeoutx"

while(true)
puts Time.now
begin
TimeoutX.timeout(15){
begin
a=DaveAlerts.new
a.doAlerts()
rescue => detail
print detail.backtrace.join("\n")
end
}
rescue => detail
print detail.backtrace.join("\n")
end
sleep(5)
end

Wc:/ruby/lib/ruby/gems/1.8/gems/timeoutx-0.3.0/lib/timeoutx.rb:40:in
`wait': execution expired (TimeoutX::Error)
from c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/lib/xmpp4r/
semaphore.rb:23:in `synchronize'
from c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/lib/xmpp4r/
semaphore.rb:23:in `wait'
from c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/lib/xmpp4r/stream.rb:
284:in `wait'
from c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/lib/xmpp4r/stream.rb:
349:in `send'
from c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/lib/xmpp4r/stream.rb:
379:in `send_with_id'
from c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/lib/xmpp4r/client.rb:
184:in `auth_nonsasl'
from c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/lib/xmpp4r/client.rb:
113:in `auth'
from ./sendIM.rb:14:in `sendMessage'
from ./imDaveAlerts.rb:20:in `doAlerts'
from ./imDaveAlerts.rb:17:in `each'
from ./imDaveAlerts.rb:17:in `doAlerts'
from myCron.rb:10
from c:/ruby/lib/ruby/gems/1.8/gems/timeoutx-0.3.0/lib/timeoutx.rb:
58:in `timeout'
from myCron.rb:7
 
Ad

Advertisements

S

Stefano Crocco

Alle Thursday 18 September 2008, Junkone ha scritto:
i thought i put enough exception handlers for the prog to continue
after failure. why does it stop
require 'imDaveAlerts'
require "timeoutx"

while(true)
puts Time.now
begin
TimeoutX.timeout(15){
begin
a=DaveAlerts.new
a.doAlerts()
rescue => detail
print detail.backtrace.join("\n")
end
}
rescue => detail
print detail.backtrace.join("\n")
end
sleep(5)
end

Wc:/ruby/lib/ruby/gems/1.8/gems/timeoutx-0.3.0/lib/timeoutx.rb:40:in
`wait': execution expired (TimeoutX::Error)

If no exception class is specified, rescue only rescues exceptions derived
from StandardError, which TimeoutX::Error is not. If you want to rescue all
exceptions, you need to explicitly write

rescue Exception

I hope this helps

Stefano
 

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

Top