From: Paul Brannan Date: 2002-03-21T05:31:35+09:00 Subject: Re: extending an exception On Thu, Mar 21, 2002 at 02:04:10AM +0900, ts wrote: > When you write this ruby allocate a new exception object Ah, that makes sense. I've done the following now so that I can use the same call to raise with an extended exception as I would with a normal exception: module Exception_Data_Mixin attr_accessor :data def self.extend_object(obj) obj.instance_eval { @mesg = self.message } super(obj) end def exception(mesg=nil) @mesg = mesg.nil? ? self.message : mesg return self end def to_s return @mesg end alias_method :message, :to_s end Thanks a bunch, Paul