Alex Rivera | Logout

Ruby rescue all exceptions except MyException

Asked 2011-01-25T17:06:33.393
22

In Ruby, is it possible to rescue all exceptions except for a specified one?

Edit
Report

1 Answer

55
begin

rescue MyException
  raise #to reraise the same exception without changing it
rescue Exception => e
  #do something with e
end
answered 2011-01-25T17:11:59.910

Your Answer