From: ts Date: 2002-03-21T02:04:10+09:00 Subject: Re: extending an exception >>>>> "P" == Paul Brannan writes: P> raise $!, $!.message, $!.backtrace When you write this ruby allocate a new exception object P> module Exception_Data_Mixin P> attr_accessor :data P> end module Exception_Data_Mixin attr_accessor :data def initialize(arg) super arg[0] @data = arg[1] end end begin begin raise 'Foo!' rescue RuntimeError $!.extend(Exception_Data_Mixin) $!.data = 42 raise $!, [$!.message, $!.data], $!.backtrace end rescue RuntimeError p $!.data #=> nil p $!.backtrace end Guy Decoux