P
Philip Mak
This code will catch the exception in Ruby 1.6:
require 'timeout'
begin
raise TimeoutError
rescue
puts "Rescued!"
end
But in Ruby 1.8, it will not catch the exception. I found out that if
I do "rescue Exception" instead of just "rescue", it will work.
So, my question is, if I want to rescue any exception no matter what
it is, do I have to start typing "rescue Exception" instead of
"rescue"?
require 'timeout'
begin
raise TimeoutError
rescue
puts "Rescued!"
end
But in Ruby 1.8, it will not catch the exception. I found out that if
I do "rescue Exception" instead of just "rescue", it will work.
So, my question is, if I want to rescue any exception no matter what
it is, do I have to start typing "rescue Exception" instead of
"rescue"?