Sorry..

Des this help?

begin
  puts 1/0
  rescue  Exception, NameError => e
  print "this is an error [#{e}] ----->[#{e.backtrace}]<-------"
  print $!.inspect #Ruby places a reference to the associated Exception
object into the global variable $!
 end 

this is an error [divided by 0]
----->[/Users/jes/error.rb:2:in `/'/Users/jes/error.rb:2]<-------
#<ZeroDivisionError: divided by 0>

> From: Ralph Shnelvar <ralphs / dos32.com>
> Organization: Ralph Shnelvar
> Reply-To: <ruby-talk / ruby-lang.org>
> Date: Thu, 29 Jul 2010 06:09:07 +0900
> To: ruby-talk ML <ruby-talk / ruby-lang.org>
> Subject: Re: rubyw, RuntimeError, capturing the stack, FXRuby
> 
> Joseph,
> 
> This does not give the call stack with file names and line numbers of the
> exception.
> 
> Thanks.
> 
> Ralph
> 
> 
> 
> Wednesday, July 28, 2010, 2:58:20 PM, you wrote:
> 
> JES> begin
> JES>   puts 1/0
> JES>   rescue  Exception, NameError => e
> JES>   print "this is an error [#{e}]"
> JES>   print $!.inspect #Ruby places a reference to the associated Exception
> JES> object into the global variable $!
> JES>  end 
> 
> JES> output: this is an error [divided by 0]#<ZeroDivisionError: divided by 0>
> 
> 
> 
>>> From: Ralph Shnelvar <ralphs / dos32.com>
>>> Organization: Ralph Shnelvar
>>> Reply-To: <ruby-talk / ruby-lang.org>
>>> Date: Thu, 29 Jul 2010 05:44:36 +0900
>>> To: ruby-talk ML <ruby-talk / ruby-lang.org>
>>> 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
>>> - - -
> 
> 
> 
> 
> 
> -- 
> Best regards,
>  Ralph                            mailto:ralphs / dos32.com