If you must rescue Exception . . .

29
Oct/09
0

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
Filed under: Code, Ruby
Comments (0) Trackbacks (0)

No comments yet.

Leave a comment

No trackbacks yet.