From: Paul Brannan Date: 2005-05-18T05:36:37+09:00 Subject: Re: "Verbose" backtracing If you are using a ruby later than 1.8 and you only need to know the state of objects when an exception is raised, you could do something like this: class Exception alias_method :old_init, :initialize attr_reader :state def initialize(*args) old_init(*args) @state = STATE_OBJS.map { |obj| obj.dup } end STATE_OBJS = [] end def foo bar end def bar raise "testing!" end obj1 = [ 1, 2, 3 ] obj2 = "foo" Exception::STATE_OBJS << obj1 Exception::STATE_OBJS << obj2 begin foo() rescue => exc p exc.state #=> [[1, 2, 3], "foo"] end Paul