# Contine after exception

**URL:** <https://www.ruby-forum.com/t/contine-after-exception/99350>\
**Category:** Ruby\
**Created:** [July 21, 2006, 10:24pm UTC](https://www.ruby-forum.com/t/contine-after-exception/99350 "2006-07-21T22:24:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 21, 2006, 10:24pm UTC](https://www.ruby-forum.com/t/contine-after-exception/99350/1 "2006-07-21T22:24:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 21, 2006, 10:37pm UTC](https://www.ruby-forum.com/t/contine-after-exception/99350/2 "2006-07-21T22:37:45Z")

</div>

On 21/07/06, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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/](http://ruby.brian-schroeder.de/)

Stringed instrument chords: [http://chordlist.brian-schroeder.de/](http://chordlist.brian-schroeder.de/)
