Exception#set_backtrace doesn't have any effect

I want to attach debug information to some of my exceptions, however I
have problems transfering the backtrace array from the original to the new
exception. It seems as #set_backtrace doesn’t have any effect?
What am I doing wrong?

Any suggestions how to do such thing?

I would have expected the output of following snippet to contain
these a:0:A b:1:B c:2:C entries… but that doesn’t happen.

ruby a.rb
a.rb:17:in `mk_problem’: we got nuked (TolerantError)
from a.rb:19
expand -t2 a.rb
def trigger
raise “dodge this”
end
def dropbomb
trigger
end
def transportbomb
dropbomb
end
class TolerantError < StandardError; end
def mk_problem
transportbomb
rescue => e
#p e.backtrace
error = TolerantError.new(“we got nuked”)
error.set_backtrace(%w(a:0:A b:1:B c:2:C))
raise error
end
mk_problem

···


Simon Strandgaard

Hi,

···

In message “Exception#set_backtrace doesn’t have any effect” on 04/04/01, Simon Strandgaard neoneye@adslhome.dk writes:

I want to attach debug information to some of my exceptions, however I
have problems transfering the backtrace array from the original to the new
exception. It seems as #set_backtrace doesn’t have any effect?
What am I doing wrong?

Any suggestions how to do such thing?

It’s a bug fixed in the latest CVS.

						matz.

Thanks… I better use cvs-head :wink:

···

On Thu, 01 Apr 2004 11:55:27 +0900, Yukihiro Matsumoto wrote:

In message “Exception#set_backtrace doesn’t have any effect” > on 04/04/01, Simon Strandgaard neoneye@adslhome.dk writes:

I want to attach debug information to some of my exceptions, however I
have problems transfering the backtrace array from the original to the new
exception. It seems as #set_backtrace doesn’t have any effect?
What am I doing wrong?

Any suggestions how to do such thing?

It’s a bug fixed in the latest CVS.

  					matz.


Simon Strandgaard

I want to attach debug information to some of my exceptions, however I
have problems transfering the backtrace array from the original to the new
exception. It seems as #set_backtrace doesn’t have any effect?
What am I doing wrong?

Any suggestions how to do such thing?

It’s a bug fixed in the latest CVS.

  					matz.

Thanks… I better use cvs-head :wink:

Installation via cvs went fine… no problems.
Just a minor nitpick, maybe move the ‘ri document generation’
from ‘install’ target to ‘all’ target?

Anyway, now #set_backtrace is working :wink:

ruby a.rb
from b:1:B
from c:2:C
ruby -v
ruby 1.9.0 (2004-03-31) [i386-freebsd5.1]

···

On Thu, 01 Apr 2004 04:59:47 +0200, Simon Strandgaard wrote:

On Thu, 01 Apr 2004 11:55:27 +0900, Yukihiro Matsumoto wrote:

In message “Exception#set_backtrace doesn’t have any effect” >> on 04/04/01, Simon Strandgaard neoneye@adslhome.dk writes:
a:0:A: we got nuked (TolerantError)


Simon Strandgaard