From: Paul Rogers Date: 2007-04-24T12:30:05+09:00 Subject: Re: exception and $! On Apr 23, 9:10 pm, Phillip Gawlowski wrote: > Paul Rogers wrote: > > Thanks, I actually wanted to see what the last exception was out side > > of a block, kind of like this > > begin > > raise "bad" > > rescue => e > > puts "#{e} was raised" > > end > > puts "Just to make sure, last exception was #{$!}" > > If you change the above into > puts "Just to make sure, last exception was #{e}" > > you get what you want. > > -- > Phillip "CynicalRyan" Gawlowskihttp://cynicalryan.110mb.com/http://clothred.rubyforge.org > > Rules of Open-Source Programming: > > 22. Backward compatibility is your worst enemy. > > 23. Backward compatibility is your users' best friend. Once again, thanks, that works, but Im still after something slightly different def ex begin raise "oh no" resuce =>e puts "Exception was #{e}" end end ex puts $! The $! seemed like a good way to do what I wanted, as i read it to be independant of the scope the exception occured in.