If you must rescue Exception . . .

by john on October 29, 2009

Sometimes you see Ruby code that rescue an exception at the top of the hierarchy:


rescue Exception => e

If you must do that, how about providing a means to control-C, by putting this in the method with the rescue:


trap("INT") do
  puts "Terminating . . . "
 return # or maybe exit
end

Leave a Comment

Previous post: Good example of antiquity of some Core Ruby classes

Next post: Michelle Wildgen, But Not For Long (Book Review)