Contine after exception

How do i continue a loop after a exception? It actually captures the
exception . How do i get the exception handler to start executing from
4 to call the printstuff function?

def printStuff(inpu) ## just print stuff
puts “printing” + inpu.to_s
if (inpu==3)
raise RetryException.new(true)
end

raise RuntimeError

end
def enter1
begin
[1,2,3,4,5,6,7,8].each{|value| printStuff(value)}#call function
to print.

rescue RetryException

puts " inside rescuedo nothing"
###QUESTION: how to continue calling
#puts dd.okToRetry

rescue
puts “other exception”
ensure
puts “insode ensire”
end
end
end

On 21/07/06, [email protected] [email protected] wrote:

raise RuntimeError

###QUESTION: how to continue calling

Try with

(1…8).each do | value |
begin
raise “Exception” if value == 3
puts value
rescue
puts “That was exceptional”
end
end

cheers,

Brian


http://ruby.brian-schroeder.de/

Stringed instrument chords: http://chordlist.brian-schroeder.de/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs