I was just caught out by this odd behaviour: a 'rescue' clause doesn't
generate an error if given a non-exception class. I had actually written
rescue Timeout
which was silently accepted but didn't work. Actually it should have been
rescue TimeoutError
The following snippet demonstrates:
---- 8< ----------------------------------------------------
require 'timeout'
begin
rescue Timeout # this line is accepted
end
raise Timeout # but this line is not:
# "exception class/object expected (TypeError)"
---- 8< ----------------------------------------------------
So, perhaps 'rescue' should check that its parameter is_a?(Exception). Does
it have any meaning to use rescue with a non-exception class?
Regards,
Brian.