From: sto.mar@... Date: 2012-12-05T04:51:48+09:00 Subject: Re: Weird rescue Am 04.12.2012 19:13, schrieb Kai K�nig: > Can somebody tell why this happens ? > > > x = StandardError.new(:hello) > y = StandardError.new(:hello) > puts x == y # => true > puts x === y # => true > > begin > raise x > rescue x > puts "ok" # gets printed > end > > begin > raise x > rescue y > puts "ok" # doesn't get printed > end > did you mean: class MyStandardError < StandardError; end x = MyStandardError.new(:hello) y = MyStandardError.new(:hello) begin raise x rescue MyStandardError puts 'ok' end # => ok begin raise y rescue MyStandardError puts 'ok' end # => ok --