From: Chris Hulan Date: 2010-04-07T02:10:08+09:00 Subject: Re: Custom Exceptions On Apr 6, 11:56 am, Brian Candler wrote: > Chris Hulan wrote: > > The default Exception:initialize is defined to take 1 parameter, a > > string containing the error message > > But 'raise' also lets you pass an error message, in addition to the > exception instance. > > Note that even the default constructor doesn't create an instance > variable called @message. > > class Foo < StandardError > end > > begin >   raise Foo, "bar" > rescue Foo => e >   p e >   p e.instance_variables >   p e.instance_variable_get(:@message) >   p e.message >   p e.backtrace > end > > # > []              # << No instance variables! > nil             # << No @message! > "bar" > ["ert.rb:5"] > -- > Posted viahttp://www.ruby-forum.com/. I should stop answering questions based on reading the docs at ruby- docs.org, they are just not very clear...plus sloppy reading on my part doesn't help ;) So message is not an attribute so using @message is wrong. It looks like overriding to_s, or maybe using super in the override of message to get the parents input. cheers