Handling Passed Exceptions : rescue « Statement « Ruby





Handling Passed Exceptions

begin
  puts 10 / 0
rescue => e
  puts e.class
end

 

Related examples in the same category

1.rescue's syntax makes handling different exceptions in different ways easy:
2.C++, Java, and Ruby exception handling compared
3.how exceptions work in Ruby.
4.Handling Exceptions: 10 / 0
5.begin