ruby on rails - Rescue nested method call -


i read ruby doesn't have nested rescues. why won't work?

begin     dosomething rescue => e     #this never executed, dosomething raises error directly end  def dosomething     somemodel.find(-1) #this raises exception instead of above end 

good day. must read ruby doc exceptions in short: exception - base class exceptions, therefore base code:

begin   # code rescue exception => e end 

you should specify exception handle if need proc - use class exception

enter image description here

p.s. self education - http://rubylearning.com/satishtalim/ruby_exceptions.html


Popular posts from this blog