ruby rescue exception code example
Example 1: ruby catch all exceptions
begin
raise 'This exception will be rescued!'
rescue StandardError => e
puts "Rescued: #{e.inspect}"
end
Example 2: ruby rase exception
raise StandardError.new "This is an exception"