From: "Joseph E. Savard" Date: 2010-07-29T05:58:20+09:00 Subject: Re: rubyw, RuntimeError, capturing the stack, FXRuby begin puts 1/0 rescue Exception, NameError => e print "this is an error [#{e}]" print $!.inspect #Ruby places a reference to the associated Exception object into the global variable $! end output: this is an error [divided by 0]# > From: Ralph Shnelvar > Organization: Ralph Shnelvar > Reply-To: > Date: Thu, 29 Jul 2010 05:44:36 +0900 > To: ruby-talk ML > Subject: rubyw, RuntimeError, capturing the stack, FXRuby > > Let's say I'm running rubyw and a RunTimeError is raised ... > > and I'm using FXRuby (which is tangential to this question) ... > > and I want to put up a errorbox ... > > But I want to capture the error message that would normally go to stdout, i.e. > the call stack ... > > How would I capture the call stack to a string in a raised exception? > > - - - > begin > raise RuntimeError, "Something bad happened" > rescue > # What do I do here? > end > - - -